Add new script liloconfig
[rrq/maintain_lilo.git] / debian / scripts / lilo-uuid-diskid
index 7f1772f355bc7821ccc8f26aa362b24e05d5ce97..ab03744ade7667fe80525a48ea1e8496eb45a7e6 100644 (file)
@@ -204,11 +204,11 @@ sub read_fstab {
        }
        # check if the found partition is a raid volume
        if($root_part =~ /\/dev\/md/) {
-               $root_part = check_raid($root_part);
        }
-       # now find the right block device name
-       $root_part =~ s/\d+$//;
-       $root_part =~ s/part$/disc/;
+       unless ($root_part =~ /^UUID/) {
+               # now find the right block device name
+               $root_part =~ s/\d+$//;
+       }
 
        return $root_part;
 }
@@ -216,14 +216,13 @@ sub read_fstab {
 sub check_raid {
        
        my $part = $_[0];
-
+       my $mdname;
+       my $md;
+       my @devices;
+       
        # check if the found partition is a raid volume
        if($part =~ /\/dev\/md/)
        {
-               my $mdname;
-               my $md;
-               my @devices;
-       
                $mdname = $part;
                $mdname =~ s/\/dev\///;
                $mdname =~ s/\///;
@@ -256,7 +255,7 @@ sub detect_root_device {
                }
        }
 
-       # check if root device exist
+       # check if root device exist / also for raid volume
        if (-b $root_disk) {
                if($opt_v) { print "convert root option $root_disk into new UUID\n"; }
                $root_id = find_id_link($root_disk,$uuidpath);
@@ -269,8 +268,8 @@ sub detect_root_device {
                $root_link =~ s{\"}{}g;
                $root_link =~ s{^LABEL=}{/dev/disk/by-label/};
                $root_link =~ s{^UUID=}{/dev/disk/by-uuid/};
-               if (not -b $root_link) {
-                       if($opt_v) { print "cannot check $root_disk: link does not exist!\n"; }
+               if (not -l $root_link) {
+                       if($opt_v) { print "cannot check $root_link: link does not exist!\n"; }
                }
        }
        return $exit;
@@ -325,6 +324,7 @@ sub write_boot_option {
                @status = stat($liloconf);
                move ($liloconf, $liloconfold);
                utime ($status[9],$status[9],$liloconfold);
+               chmod (0600,$liloconfold);
 
                # copy all lines from lilo.conf_old into
                # new lilo.conf and add 'boot=' line
@@ -378,6 +378,7 @@ sub write_boot_option {
                }
                close(MYFH_OLD);
                close(MYFH_NEW);
+               chmod (0600,$liloconf);
        }
        else {
                print "file $liloconf does not exist: nothing changed\n";
@@ -443,7 +444,7 @@ Lines in the configuration file /etc/lilo.conf:
   boot = /dev/disk/by-id/ata-SAMSUNG_SV1604N_S01FJ10X999999
 
   #root = /dev/sda1
-  root = "UUID=/dev/disk/by-uuid/18843936-00f9-4df0-a373-000d05a5dd44"
+  root = "UUID=18843936-00f9-4df0-a373-000d05a5dd44"
 
 =head1 OPTIONS