- # finally write new lilo.conf file
- if ($found) {
- if ($opt_u) { $exit = update_lilo_conf(); }
- else { $exit = write_lilo_conf(); }
+ my $exit = 1;
+ my $found1 = 0;
+ my $found2 = 0;
+ my $found3 = 0;
+
+ # read fstab and search for root device
+ $found1 = read_fstab();
+
+ ## STEP 1 ##
+ if ($found1 == 0)
+ # nothing found, exit by error
+ { $found2 = 0;}
+ elsif ($found1 == 1)
+ # identify root device: root_dev and root_id
+ { $found2 = convert_root_device(); }
+ elsif ($found1 == 2)
+ # nothing found, but exit successfully
+ { $exit = 0; $found2 = 0;}
+
+ ## STEP 2 ##
+ if ($found2 == 0)
+ # nothing found, exit by error
+ { $found3 = 0;}
+ elsif ($found2 == 1)
+ # convert root device to boot device
+ { $found3 = convert_boot_device(); }
+ elsif ($found2 == 2)
+ # nothing found, but exit successfully
+ { $exit = 0; $found2 = 3;}
+
+ ## STEP 3 ##
+ if ($found3 == 0)
+ # nothing found, exit by error
+ { $exit = 1;}
+ elsif ($found3 == 1) {
+ if ((-f $liloconf) and not (-w $liloconf)) {
+ print "E: Have no write permissions to $liloconf !\n";
+ $exit = 1;
+ }
+ else {
+ # finally write new/updated lilo.conf file
+ if ($opt_u) { $exit = update_lilo_conf(); }
+ else { $exit = write_lilo_conf(); }
+ }