Neil Bothwick wrote: > On Fri, 13 Apr 2007 01:33:43 +0200, Bo Ørsted Andresen wrote: > >>>> At around 300MB per kernel, that's ten excess kernels, so you can't >>>> be doing it that often. Once you're happy with the current kernel, >>>> you only need "emerge -P gentoo-sources" to remove the rest. I use >>>> a script that removes all but the last two, and also cleans >>>> out /lib/modules and /boot. >>> Neil, any chance we could get that script? >> Provided you have gentoolkit something as simple as this works: >> >> # emerge -Cva $(equery -q list gentoo-sources | head -n -2) > > That only cleans out /usr/src, it's slightly different to what I use > (which rm's the directories first to speed things up) but does basically > the same. You also need to clear out /lib/modules and /boot with > > Here's the script I use, which is guaranteed to work when it doesn't > fail. When it does break, you can keep the pieces. > > #!/bin/bash > > # clean /lib/modules > cd /lib/modules > ls -1rt | head -n -2 | xargs --no-run-if-empty rm -fr > > # clean /boot > grep --quiet /boot /etc/fstab && mount /boot -o remount,rw > > cd /boot > ls -1rt config-* | head -n -2 | while read f; do > bzip2 -9 $f > mv $f.bz2 oldconfigs/ > done > > ls -1rt System.map-* | head -n -2 | xargs --no-run-if-empty rm -f > if [ -f vmlinux ]; then > ls -1rt vmlinux-* | head -n -2 | xargs --no-run-if-empty rm -f > else > ls -1rt vmlinuz-* | head -n -2 | xargs --no-run-if-empty rm -f > fi > > # clean /usr/src > cd /usr/src > ls -1drt linux-* | head -n -2 | xargs --no-run-if-empty rm -fr > equery --quiet --nocolor list --duplicates gentoo-sources | awk '{print $1}' > | head -n -2 | xargs --no-run-if-empty emerge --unmerge &>/dev/null > > grep --quiet /boot /etc/fstab && mount /boot -o remount,ro > # END > > The vmlinuz/vmlinux stuff is because I have a PPC system too, which calls the > kernel vmlinux. > >
Thanks Neil. Tony -- Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety. -- Benjamin Franklin -- [EMAIL PROTECTED] mailing list