diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2005-08-29 10:51:59 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2005-08-29 10:51:59 +0000 |
commit | e816be2f6f1fd851ab9586ddc297e38e3d7ac450 (patch) | |
tree | 7c5f5862cd1913c72b88c2d8989b66ea8deb7b62 | |
parent | 7de8a96d9e4b7aaebb7097b584e5ef2ca2d317c0 (diff) | |
download | drakx-e816be2f6f1fd851ab9586ddc297e38e3d7ac450.tar drakx-e816be2f6f1fd851ab9586ddc297e38e3d7ac450.tar.gz drakx-e816be2f6f1fd851ab9586ddc297e38e3d7ac450.tar.bz2 drakx-e816be2f6f1fd851ab9586ddc297e38e3d7ac450.tar.xz drakx-e816be2f6f1fd851ab9586ddc297e38e3d7ac450.zip |
handle reading & writing \" in lilo.conf
-rw-r--r-- | perl-install/bootloader.pm | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index f1eb4af49..b5e675efb 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -322,6 +322,7 @@ sub read_lilo() { local ($_) = @_; s/^\s*//; s/\s*$//; s/^"(.*?)"$/$1/; + s/\\"/"/g; s/^\s*//; s/\s*$//; #- do it again for append=" foo" $_; } @@ -1063,10 +1064,17 @@ sub write_lilo { } }; + my $quotes = sub { + my ($s) = @_; + $s =~ s/"/\"/g; + qq("$s"); + }; + my $quotes_if_needed = sub { my ($s) = @_; - $s =~ /[=\s]/ ? qq("$s") : $s; + $s =~ /["=\s]/ ? $quotes->($s) : $s; }; + my @sorted_hds = sort_hds_according_to_bios($bootloader, $all_hds); @@ -1092,7 +1100,7 @@ sub write_lilo { 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); 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, "append=" . $quotes->($bootloader->{append}) if $bootloader->{append}; 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(.*)/; |