From 2e09e8695c6fe27cb95aca366aecaf18517731ac Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Fri, 17 Jun 2005 09:14:08 +0000 Subject: (write_lilo) fix support for labels (eg: when switching from GRUB to LILO, let's prevent unmanagable 'root="LABEL=..."' to appear) --- perl-install/bootloader.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index 67ab14c00..dc59b1047 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -1086,9 +1086,10 @@ 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 { $_ . '=' . $quotes_if_needed->($bootloader->{$_}) } grep { $bootloader->{$_} } qw(boot root map install vga keytable raid-extra-boot menu-scheme); + my $root_uses_label = $bootloader->{root} =~ /^LABEL=/; + push @conf, map { $_ . '=' . $quotes_if_needed->($bootloader->{$_}) } grep { $bootloader->{$_} } qw(boot map install vga keytable raid-extra-boot menu-scheme), if_(!$root_uses_label, 'root'); 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, qq(append="$bootloader->{append}), if_($root_uses_label, "root=$bootloader->{root}"), '"' if $bootloader->{append} || $root_uses_label; push @conf, "password=" . $bootloader->{password} if $bootloader->{password}; #- also done by msec push @conf, "timeout=" . round(10 * $bootloader->{timeout}) if $bootloader->{timeout}; push @conf, "serial=" . $1 if get_append_with_key($bootloader, 'console') =~ /ttyS(.*)/; @@ -1105,9 +1106,10 @@ 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=' . $quotes_if_needed->($entry->{root}) if $entry->{root}; + my $entry_root_uses_label = $entry->{root} =~ /^LABEL=/; + push @entry_conf, 'root=' . $quotes_if_needed->($entry->{root}) if $entry->{root} && !$entry_root_uses_label; push @entry_conf, "initrd=" . $file2fullname->($entry->{initrd}) if $entry->{initrd}; - push @entry_conf, qq(append="$entry->{append}") if $entry->{append}; + push @entry_conf, join('', qq(append="$entry->{append}), if_($entry_root_uses_label, "root=$entry->{root}"), '"') if $entry->{append} || $entry->{root}; push @entry_conf, "vga=$entry->{vga}" if $entry->{vga}; push @entry_conf, grep { $entry->{$_} } qw(read-write read-only optional); } else { -- cgit v1.2.1