#!/bin/sh

#
# The following sed will rewrite the portage database (VDB)
# so that slot-operator dep records of packages emerged prior to
# the ncurses:5 -> ncurses:0 slot move will be changed
# to contain the appropriate new subslot value.
#
# WARNING WARNING WARNING
# This set is DIRECTLY MODIFYING the VDB, which is rarely a good
# idea.  The author is not responsible for any breakage that may
# occur. etc. etc. agree to hold indemnitable the author and so forth.
#

# backup VDB just in case
tar -jcf /tmp/vdb-backup.tar.bz2 /var/db/pkg

# change ncurses:5/5 to ncurses:0/0, ncurses:5/6 (or any others)
# to ncurses:0/6.
sed -i \
  -e 's#sys-libs/ncurses\([^:]*\):5/5#sys-libs/ncurses\1:0/0#g' \
  -e 's#sys-libs/ncurses\([^:]*\):5/#sys-libs/ncurses\1:0/#g' \
  /var/db/pkg/*/*/*DEPEND



