Gentoo Archives: gentoo-user

From: "Anthony E. Caudel" <acaudel@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Any consequences to package.mask'ing newer kernels?
Date: Fri, 13 Apr 2007 22:56:26
Message-Id: 462008E0.50209@gt.rr.com
1 Neil Bothwick wrote:
2 > On Fri, 13 Apr 2007 01:33:43 +0200, Bo Ørsted Andresen wrote:
3 >
4 >>>> At around 300MB per kernel, that's ten excess kernels, so you can't
5 >>>> be doing it that often. Once you're happy with the current kernel,
6 >>>> you only need "emerge -P gentoo-sources" to remove the rest. I use
7 >>>> a script that removes all but the last two, and also cleans
8 >>>> out /lib/modules and /boot.
9 >>> Neil, any chance we could get that script?
10 >> Provided you have gentoolkit something as simple as this works:
11 >>
12 >> # emerge -Cva $(equery -q list gentoo-sources | head -n -2)
13 >
14 > That only cleans out /usr/src, it's slightly different to what I use
15 > (which rm's the directories first to speed things up) but does basically
16 > the same. You also need to clear out /lib/modules and /boot with
17 >
18 > Here's the script I use, which is guaranteed to work when it doesn't
19 > fail. When it does break, you can keep the pieces.
20 >
21 > #!/bin/bash
22 >
23 > # clean /lib/modules
24 > cd /lib/modules
25 > ls -1rt | head -n -2 | xargs --no-run-if-empty rm -fr
26 >
27 > # clean /boot
28 > grep --quiet /boot /etc/fstab && mount /boot -o remount,rw
29 >
30 > cd /boot
31 > ls -1rt config-* | head -n -2 | while read f; do
32 > bzip2 -9 $f
33 > mv $f.bz2 oldconfigs/
34 > done
35 >
36 > ls -1rt System.map-* | head -n -2 | xargs --no-run-if-empty rm -f
37 > if [ -f vmlinux ]; then
38 > ls -1rt vmlinux-* | head -n -2 | xargs --no-run-if-empty rm -f
39 > else
40 > ls -1rt vmlinuz-* | head -n -2 | xargs --no-run-if-empty rm -f
41 > fi
42 >
43 > # clean /usr/src
44 > cd /usr/src
45 > ls -1drt linux-* | head -n -2 | xargs --no-run-if-empty rm -fr
46 > equery --quiet --nocolor list --duplicates gentoo-sources | awk '{print $1}' | head -n -2 | xargs --no-run-if-empty emerge --unmerge &>/dev/null
47 >
48 > grep --quiet /boot /etc/fstab && mount /boot -o remount,ro
49 > # END
50 >
51 > The vmlinuz/vmlinux stuff is because I have a PPC system too, which calls the kernel vmlinux.
52 >
53 >
54
55 Thanks Neil.
56
57 Tony
58
59 --
60 Those who would give up essential Liberty, to purchase a little
61 temporary Safety, deserve neither Liberty nor Safety.
62 -- Benjamin Franklin
63 --
64 gentoo-user@g.o mailing list