#!/bin/bash # This script is a hack way of regenerating the package database # without re-compiling all your packages. What happens here is # we read your world and system files and then create a cache # entry for that package. This is a hack way of doing this and will # result as spyderous (#gentoo) put it "in orphaned files". # # Given that this is a hack job it is advised that you rebuild your # binaries over time so that the entire cache does get repopulated # properly. Please note that you may find with packages such as # mozilla that you can remove an old version directory once it has # been replaced with another. TMPLOC="/tmp/regenpkg.tmp" TMPLOC2="/tmp/regenpkg2.tmp" WORLDFILE="/var/lib/portage/world" CACHEDIR="/var/db/pkg" echo "Creating a list of system packages that need to be restored..." touch ${TMPLOC} mkdir -p ${CACHEDIR} > /dev/null emerge -p system |grep ebuild |sed -e 's:\[ebuild\ \ N\ \ \ \]\ ::' > ${TMPLOC} echo "Begining the restoration process, this will take some time..." for a in `cat $TMPLOC`; do mkdir -p ${CACHEDIR}/${a} cd ${CACHEDIR}/${a} touch CATEGORY CFLAGS CHOST CONTENTS COUNTER CXXFLAGS \ LICENSE PF PROVIDE RDEPEND SLOT USE done echo "System restore complete..." echo "" echo "Creating a list of world packages that need to be restored..." rm ${TMPLOC} && touch ${TMPLOC} && touch ${TMPLOC2} emerge -ep `cat ${WORLDFILE}` |grep ebuild |sed -e 's:\[ebuild\ \ N\ \ \ \]\ ::' > ${TMPLOC2} sed -e 's:\[ebuild\ \ \ \ U-\]\ ::' ${TMPLOC2} > ${TMPLOC} echo "Begining the restoration process, this will take some time..." for a in `cat $TMPLOC`; do mkdir -p ${CACHEDIR}/${a} cd ${CACHEDIR}/${a} touch CATEGORY CFLAGS CHOST CONTENTS COUNTER CXXFLAGS \ LICENSE PF PROVIDE RDEPEND SLOT USE done echo "World restore complete..." echo "" echo "We are finished. Please note that you now have an injected world" echo "and system cache. This is not optimal but will do for the time being" echo "it is recommended that you keep your system upto date regularly" echo "so that you allieviate this problem. Also if you are using a package" echo "that does not get updated regularly then you may wish to rebuild" echo "that package." echo "" echo "Please run regenworld now to ensure that your files are up-to-date" echo "and that your cache will not be skewed to the installed packages." echo "It is also recommended that you perform a world update to catch " echo "any packages that were not listed in your system and world files." echo "" echo "Please note that this is a beta release, eventually this script will" echo "allow packages to regain parentship over their files. See the comments" echo "within this script for a more detailed explanation of what this means"