# liloconfig - creating a new lilo.conf file
#
-# Copyright 2011 Joachim Wiedorn <ad_debian@joonet.de>
+# Copyright 2011-2013 Joachim Wiedorn <ad_debian@joonet.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#---- global variables
my $prog = $0;
$prog =~ s#.*/##;
-my $version = "0.1";
+my $version = "0.2";
#---- parameter check
# h: help, v: verbose, f: force
our $idpath = "/dev/disk/by-id";
our $uuidpath = "/dev/disk/by-uuid";
our $lblpath = "/dev/disk/by-label";
-our $template = "/etc/lilo.conf_example";
+our $template = "/usr/share/doc/lilo/examples/lilo.example.conf.gz";
our $rootpart; # found root part
our $root_dev; # /dev/hdX9, /dev/sdX9, /dev/md/*
my $nr2;
# search for kernel image files
- my @vmlinuz = readpipe("/bin/ls -t -1 /boot/vmlinuz-2* 2>/dev/null");
+ my @vmlinuz = readpipe("/bin/ls -t -1 /boot/vmlinuz-* 2>/dev/null");
# append to new lilo.conf
open(MYFH_NEW, ">> $liloconfnew") or die "Cannot open file: $!";
$initrd =~ s/vmlinuz/initrd\.img/;
$nr2 = $nr + 1;
- print MYFH_NEW 'image = ' . $image . "\n";
- if($opt_v) { print 'image = ' . $image . "\n"; }
+ print MYFH_NEW 'image = ' . $image . "\n";
+ if($opt_v) { print 'image = ' . $image . "\n"; }
+
if ($nr == 0) {
print MYFH_NEW "\t" . 'label = "Linux"' . "\n";
if($opt_v) { print "\t" . 'label = "Linux"' . "\n"; }
print MYFH_NEW "\t" . 'label = "Linux Old"' . "\n";
if($opt_v) { print "\t" . 'label = "Linux Old"' . "\n"; }
}
+
if ($root_id) {
print MYFH_NEW "\t" . '#root = ' . $root_dev . "\n";
if($opt_v) { print "\t" . '#root = ' . $root_dev . "\n"; }
print MYFH_NEW "\t" . 'root = ' . $root_dev . "\n";
if($opt_v) { print "\t" . 'root = ' . $root_dev . "\n"; }
}
- print MYFH_NEW "\t" . 'read-only' . "\n";
- if($opt_v) { print "\t" . 'read-only' . "\n"; }
- print MYFH_NEW "#\t" . 'restricted' . "\n";
- if($opt_v) { print "#\t" . 'restricted' . "\n"; }
- print MYFH_NEW "#\t" . 'alias = ' . "$nr2" . "\n";
- if($opt_v) { print "#\t" . 'alias = ' . "$nr2" . "\n"; }
- print MYFH_NEW "#\t" . 'optional' . "\n";
- if($opt_v) { print "#\t" . 'optional' . "\n"; }
+
+ print MYFH_NEW "\t" . 'read-only' . "\n";
+ if($opt_v) { print "\t" . 'read-only' . "\n"; }
+ print MYFH_NEW "#\t" . 'restricted' . "\n";
+ if($opt_v) { print "#\t" . 'restricted' . "\n"; }
+ print MYFH_NEW "#\t" . 'alias = ' . "$nr2" . "\n";
+ if($opt_v) { print "#\t" . 'alias = ' . "$nr2" . "\n"; }
+ print MYFH_NEW "#\t" . 'optional' . "\n";
+ if($opt_v) { print "#\t" . 'optional' . "\n"; }
+
if (-f $initrd) {
print MYFH_NEW "\t" . 'initrd = ' . $initrd . "\n";
if($opt_v) { print "\t" . 'initrd = ' . $initrd . "\n"; }
}
- print MYFH_NEW "\n";
- if($opt_v) { print "\n"; }
+ else {
+ if($opt_v) { print "initrd $initrd could not be found!\n" }
+ }
+
+ print MYFH_NEW "\n";
+ if($opt_v) { print "\n"; }
$nr++;
last if ($nr > 1);
#boot = /dev/sda
boot = /dev/disk/by-id/ata-SAMSUNG_SV1604N_S01FJ10X999999
- image = /boot/vmlinuz-2.6.32-5book-686
+ image = /boot/vmlinuz-3.5.0-trunk-686
label = "Linux"
#root = /dev/sda1
root = "UUID=18843936-00f9-4df0-a373-000d05a5dd44"
# restricted
# alias = 1
# optional
- initrd = /boot/initrd.img-2.6.32-5book-686
+ initrd = /boot/initrd.img-3.5.0-trunk-686
- image = /boot/vmlinuz-2.6.32-5-686
+ image = /boot/vmlinuz-3.2.0-4-686
label = "Linux Old"
#root = /dev/sda1
root = "UUID=18843936-00f9-4df0-a373-000d05a5dd44"
# restricted
# alias = 2
# optional
- initrd = /boot/initrd.img-2.6.32-5-686
+ initrd = /boot/initrd.img-3.2.0-4-686
=head1 OPTIONS