Messages in this thread |  | | Date | 24 Nov 2001 12:01:00 +0200 | From | (Kai Henningsen) | Subject | Re: is 2.4.15 really available at www.kernel.org? |
| |
mhw@wittsend.com (Michael H. Warfield) wrote on 23.11.01 in <20011123185407.A3499@alcove.wittsend.com>:
> I typically keep 4 to six fall back versions in each of the > 2.2 and 2.4 lines active and want (or occasionally need) to target specific > versions, especially when I'm testing preX kernels and my device driver. > You are way TOO simple.
I keep more (though I really don't need that many) ... and I *do* add text to kernel names myself.
So I wrote a (very quick-and-dirty) little Perl script. Maybe a variant of that works for other people, too.
Features: label is (hopefully sensibly) shortened image name. Also, a number is used as an alias; it's easier to select "1" than some lengthy string. Kernels are (hopefully) sorted chronologically (this doesn't work if EXTRAVERSION starts with a letter).
WARNING: this makes some assumptions about my system. You need to adapt that part.
WARNING: the sort routine only works on a Debian system. If you live on something else, adapt the sorter.
The script asks before overwriting your lilo.conf and keeps backups, so you have a chance of looking at the result and tweaking the script before committing to it.
License: public domain.
make-lilo.conf.pl: #! /usr/bin/perl -w
use strict;
open LILO, "> /etc/lilo.conf.gen" or die $!; print LILO <<headend; # LILO configuration created by $0 @{[scalar localtime]}
linear boot = /dev/sda compact delay = 100 # optional, for systems that boot very quickly #vga = normal # force sane state vga = ask root = current # use "current" root #root = /dev/sdc1 #other = /dev/sda1 # table = /dev/sda # label = dos
headend
my $sorter = sub { my ($aa, $bb) = ($a, $b); $aa =~ tr/+/-/; $bb =~ tr/+/-/; $aa eq $bb? 0: system('/usr/bin/dpkg', '--compare-versions', $aa, 'lt', $bb)? -1: 1; };
opendir BOOT, "/boot/" or die $!; my @kernels = sort $sorter grep m/linu/i, readdir BOOT; close BOOT;
my $n = 0;
for my $kernel (@kernels) { my ($version) = ($kernel =~ m/^[-a-z]*(.*)$/); $version =~ s/.*(.{15})$/$1/ if length($version) > 15; $n++; if ($n > 9) { print "Ignoring $kernel ($n)\n"; next; } print LILO <<imageend; image = /boot/$kernel label = $version alias = $n append = " hisax=3,2,10, "
imageend }
close LILO;
system('/bin/mv', '-vib', '/etc/lilo.conf.gen', '/etc/lilo.conf');
system('/sbin/lilo');
MfG Kai - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|  |