#!/bin/bash # autodepclean script v 0.01 released under GPL v3 by Walter Dnes 2010/08/18 # Generates a file "cleanscript" to remove unused ebuilds, including # buildtime-only dependancies. # # Warning; this script is still beta. I recommend that you check the output # in cleanscript before running it. It is agressive about removing unused # gentoo-sources versions. This includes those that are higher than your # current kernel. This is technically correct for removing unused ebuilds, # but it may not be what you want. # echo "#!/bin/bash" > cleanscript echo "#" > cleanscript.000 emerge --pretend --depclean |\ grep -A1 "^ .*/" |\ grep -v "^ \*" |\ grep -v "^--" |\ sed ":/: { N s:\n:: s/ selected: /-/ s/^ /emerge --depclean =/ }" >> cleanscript.000 while read do echo "${REPLY}" >> cleanscript if [ "${REPLY:0:6}" == "emerge" ]; then echo "revdep-rebuild" >> cleanscript fi done < cleanscript.000 chmod 744 cleanscript