Browse Source

orrected bugs in sub norm_root_device

master
cretzu 25 years ago
parent
commit
fa082738aa
  1. 91
      gBootRoot

91
gBootRoot

@ -37,6 +37,15 @@ my $tmp1 = "/tmp"; # tmp should be default - Cristian
my $lilo_conf = "/etc/lilo.conf"; my $lilo_conf = "/etc/lilo.conf";
# CHANGES # CHANGES
# 1.0.3a - 08.23.2000
# * corrected bugs in norm_root_device (returned always 'hda1')
# a) now closes LIL
# b) chomps all lines in one go
# c) the 'default' value is just a label, not a dev
# d) sane regexp magic
# e) "there's one more bug(tm)": does not cope with multiple
# root device occurences (which might be present in each
# 'image=' block
# 1.0.3 - 08.09.2000 # 1.0.3 - 08.09.2000
# * Tmp and mnt are now created on the fly, # * Tmp and mnt are now created on the fly,
# along with a new error function for mkdir(), # along with a new error function for mkdir(),
@ -347,27 +356,32 @@ sub signal {
# Cristian's idea - bug 111579 enh for brlilo # Cristian's idea - bug 111579 enh for brlilo
sub norm_root_device { sub norm_root_device {
my $root_dev = 'hda1';
if (!-d $lilo_conf) { if (!-d $lilo_conf) {
if (-e $lilo_conf) { if (-e $lilo_conf) {
open(LIL, $lilo_conf); open(LIL, $lilo_conf);
my @lilo_lines = <LIL>; my @lilo_lines = <LIL>;
close(LIL);
chomp(@lilo_lines);
for (@lilo_lines) { for (@lilo_lines) {
if ( m<^\s*[^#]+\s*default\s*=\s*/dev/([\w\d]+)\s*.*$> ) { next if m/^\s*[#]/;
chomp, return $1;
}
}
for (@lilo_lines) {
if ( m<^\s*[^#]+\s*root\s*=\s*/dev/([\w\d]+)\s*.*$> ) {
chomp, return $1;
}
if (m#\s*root\s*=\s*/dev/(.+)\s*#) {
$root_dev = $1;
last;
}
} }
} }
} }
open(VFN, ">> $verbosefn") or die "Oops! Can't open $verbosefn,";
print VFN "Root device found: $root_dev\n";
close(VFN);
return "hda1"; return $root_dev;
} } # end sub norm_root_device
sub create_text { sub create_text {
@ -1423,60 +1437,3 @@ Little things you may want to know:
HELP HELP
} }

Loading…
Cancel
Save