From f3aa211fc8042b544474109ef9a94baf5e36aecc Mon Sep 17 00:00:00 2001 From: freesource Date: Mon, 14 Aug 2000 02:37:29 +0000 Subject: [PATCH] Default hard drive for normalboot now taken from lilo.conf --- gBootRoot | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/gBootRoot b/gBootRoot index e99daf7..316c4a1 100644 --- a/gBootRoot +++ b/gBootRoot @@ -34,6 +34,7 @@ init Gtk; # If you want gBootRoot to do it's stuff somewhere else, change the # value for $tmp1. my $tmp1 = "/tmp"; # tmp should be default - Cristian +my $lilo_conf = "/etc/lilo.conf"; # CHANGES # 1.0.3 - 08.09.2000 @@ -86,6 +87,7 @@ my $error_window; my ($kernel,$root_image,$device,$size); my $mtab; my ($tmp,$mnt); +my $norm_root_device; # My own creation - the roots touch the ground if three lines are added. my @xpm_data = ( @@ -341,6 +343,30 @@ sub signal { Gtk->exit(0); } + +# Cristian's idea - bug 111579 enh for brlilo +sub norm_root_device { + + my $norm_root_dev = "hda1"; + + if (!-d $lilo_conf) { + if (-e $lilo_conf) { + open(LIL, $lilo_conf); + while () { + chomp; + if ( m< ^\s*[^#]+\s*root\s*=\s*/dev/([\w\d]+)\s*.*$ + | ^\s*[^#]+\s*default\s*=\s*/dev/([\w\d]+)\s*.*$ >x ) { + ($1) ? ($norm_root_dev = $1) : ($norm_root_dev = $2); + last; + } + } + } + } + + return $norm_root_dev; + +} + sub create_text { if (not defined $text_window) { @@ -837,11 +863,19 @@ sub lilo_put_it_together { #V#print "Making stuff for lilo\n"; return if err(system "mkdir $mnt/{boot,dev} >> $tmp/verbose 2>&1; cp -a /dev/{null,fd?,hda1} $mnt/dev >> $tmp/verbose 2>&1") == 2; + # Hopefully, this works, but have never tested it if ($device !~ m,/dev/fd\d{1}$,) { return if err( system "cp -a $device $mnt/dev >> $tmp/verbose 2>&1") == 2; } + + # This adds that next device + $norm_root_device = norm_root_device(); + if (!-e "$mnt/dev/$norm_root_device") { + return if err( + system "cp -a /dev/$norm_root_device $mnt/dev >> $tmp/verbose 2>&1") == 2; + } #pb($B,3); #V#print "Copy over important lilo stuff\n"; @@ -853,6 +887,9 @@ sub lilo_put_it_together { $remain_boot = $remain_boot - (stat("/boot/boot.b"))[12]/2 - 3; $entry5->set_text("$remain_boot k"); + # + + # Write out the HEREDOCS open(LC, ">$mnt/brlilo.conf") or die "Couldn't write $mnt/brlilo.conf\n"; print LC brlilo($device); close(LC); @@ -1285,7 +1322,7 @@ read-write # normalboot image = kernel -root = /dev/hda1 +root = /dev/$norm_root_device label = normalboot read-only LILOCONF @@ -1309,8 +1346,7 @@ Press [Tab] to see a list of boot options. bootdisk = This will boot a compressed root filesystem on another floppy. normalboot = This will boot up a specified filesystem. - default: /dev/hda1 a = 1st drive - 1 = 1st partition + default: /dev/$norm_root_device Use root=/dev/(h or s)dXX h = IDE Drive s = SCSI Drive