From 809bc2de38d8c976014c92193c7c2b43c9c31849 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 6 Jun 2005 04:53:41 +0000 Subject: - put quotes if needed for root=xxx (quotes are needed for LABEL=...) - use LABEL=... if preferred --- perl-install/bootloader.pm | 15 ++++++++++----- perl-install/standalone/bootloader-config | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'perl-install') diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index 24e8f9e79..1e93cd6ac 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -323,11 +323,11 @@ sub read_lilo() { $_; } - foreach ('append', 'default') { + foreach ('append', 'root', 'default') { $b{$_} = remove_quotes_and_spaces($b{$_}) if $b{$_}; } foreach my $entry (@{$b{entries}}) { - foreach ('append', 'label') { + foreach ('append', 'root', 'label') { $entry->{$_} = remove_quotes_and_spaces($entry->{$_}) if $entry->{$_}; } } @@ -711,7 +711,7 @@ sub suggest { my ($bootloader, $all_hds, %options) = @_; my $fstab = [ fs::get::fstab($all_hds) ]; my $root_part = fs::get::root($fstab); - my $root = '/dev/' . (isLoopback($root_part) ? 'loop7' : $root_part->{device}); + my $root = isLoopback($root_part) ? '/dev/loop7' : fs::part2wild_device_name('', $root_part); my $boot = fs::get::root($fstab, 'boot')->{device}; #- PPC xfs module requires enlarged initrd my $xfsroot = $root_part->{fs_type} eq 'xfs'; @@ -1056,6 +1056,11 @@ sub write_lilo { } }; + my $quotes_if_needed = sub { + my ($s) = @_; + $s =~ /[=\s]/ ? qq("$s") : $s; + }; + my @sorted_hds = sort_hds_according_to_bios($bootloader, $all_hds); if (is_empty_hash_ref($bootloader->{bios} ||= {}) && $all_hds->{hds}[0] != $sorted_hds[0]) { @@ -1078,7 +1083,7 @@ sub write_lilo { push @conf, "# File generated by DrakX/drakboot"; push @conf, "# WARNING: do not forget to run lilo after modifying this file\n"; push @conf, "default=" . make_label_lilo_compatible($bootloader->{default}) if $bootloader->{default}; - push @conf, map { "$_=$bootloader->{$_}" } grep { $bootloader->{$_} } qw(boot root map install vga keytable raid-extra-boot menu-scheme); + push @conf, map { $_ . '=' . $quotes_if_needed->($bootloader->{$_}) } grep { $bootloader->{$_} } qw(boot root map install vga keytable raid-extra-boot menu-scheme); push @conf, grep { $bootloader->{$_} } qw(linear geometric compact prompt nowarn restricted static-bios-codes); push @conf, qq(append="$bootloader->{append}") if $bootloader->{append}; push @conf, "password=" . $bootloader->{password} if $bootloader->{password}; #- also done by msec @@ -1097,7 +1102,7 @@ sub write_lilo { push @entry_conf, "label=" . make_label_lilo_compatible($entry->{label}) if $entry->{label}; if ($entry->{type} eq "image") { - push @entry_conf, "root=$entry->{root}" if $entry->{root}; + push @entry_conf, 'root=' . $quotes_if_needed->($entry->{root}) if $entry->{root}; push @entry_conf, "initrd=" . $file2fullname->($entry->{initrd}) if $entry->{initrd}; push @entry_conf, qq(append="$entry->{append}") if $entry->{append}; push @entry_conf, "vga=$entry->{vga}" if $entry->{vga}; diff --git a/perl-install/standalone/bootloader-config b/perl-install/standalone/bootloader-config index efd3c939a..42bf12fa5 100755 --- a/perl-install/standalone/bootloader-config +++ b/perl-install/standalone/bootloader-config @@ -120,7 +120,7 @@ sub add_kernel() { my $root_part = fs::get::root([ fs::get::fstab($all_hds) ]) or die "can not find root partition\n"; my %opts = ( - root => "/dev/$root_part->{device}", + root => fs::part2wild_device_name('', $root_part), initrd_options => $initrd_options, if_($label, label => $label), if_($bootloader->{default_vga}, vga => $bootloader->{default_vga}), -- cgit v1.2.1