On Sun, Apr 22, 2012 at 09:31:18AM +0800, ?????? wrote
> But it seems that the --depclean is a dangerous operate ??

  I've built a script called "autodepclean" that runs "--pretend --depclean"
and filters the output to a separate script file "cleanscript".  You can
run "autodepclean" as a regular user, but "cleanscript" has to be run as
root.  Here is how I use it...

1) Run autodepclean.  It takes approximately 30 seconds on my machine.

2) Look at cleanscript with a text-editor, and delete lines that remove
programs you want to keep.

3) Run "cleanscript" as root.  It automatically runs "revdep-rebuild" at
the end.

  Note that "nano" is no longer a system requirement.  If you want the
"nano" editor, you need to include it in world.  I.e. "emerge nano".
The "autodepclean" script is attached to this post.

-- 
Walter Dnes <waltd...@waltdnes.org>
#!/bin/bash
# autodepclean script v 0.03 released under GPL v3 by Walter Dnes 2012/01/16
# 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.
#
# With the arrival of "virtual/editor", the script now suggests removing
# app-editors/nano, which may not be what you want.  If you want to keep
# nano, put it into world
#
# version 0.03 disables the removal of gentoo-sources.  Your current kernel
# is not always the most recent one in /usr/src.
#
echo "#!/bin/bash" > cleanscript
echo "#" >> cleanscript
emerge --pretend --depclean |\
  grep -A1 "^ .*/" |\
  grep -v "^ \*" |\
  grep -v "^--" |\
  sed ":/: {
N
s:\n::
s/    selected: /-/
s/^ /emerge --depclean =/
}" | grep -v "gentoo-sources" >> cleanscript
echo "revdep-rebuild" >> cleanscript
chmod 744 cleanscript

Reply via email to