On Thu, 23 Aug 2007 14:22:03 -0400, Denis wrote: > Indeed, the old > kernel directories were still in /usr/src, and they were still filled > with executables. The modules for the old kernels in /lib/modules > were also still there. I ended up removing all those directories by > hand.
emerge --unmerge only removes files installed by portage, which is the
kernel source in this case. Files created outside of portage, when you
compile the kernel, are not included in the packages' contents files and
so remain until you delete them manually. The same applies to modules and
kernels.
> Is there a tool for automatically removing the old kernels/modules and
> all their respective directories?
I use this script to do it, saved as /usr/src/prunekernels.
#!/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 list gentoo-sources | head -n -2 | xargs --no-run-if-empty
emerge --unmerge &>/dev/null
grep --quiet /boot /etc/fstab && mount /boot -o remount,ro
--
Neil Bothwick
Yes, I am an agent of Satan, but my duties are largely ceremonial.
signature.asc
Description: PGP signature

