summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-11-26 12:17:34 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-11-26 12:17:34 +0000
commit51c97621ccb1790cd125800af1add6a3c47c7869 (patch)
treea6b823ff76f5cb48e35fc04ecee768b21809be55
parentf229e10ccdb1aca5c9b0b5421a347b249b810073 (diff)
downloaddrakx-51c97621ccb1790cd125800af1add6a3c47c7869.tar
drakx-51c97621ccb1790cd125800af1add6a3c47c7869.tar.gz
drakx-51c97621ccb1790cd125800af1add6a3c47c7869.tar.bz2
drakx-51c97621ccb1790cd125800af1add6a3c47c7869.tar.xz
drakx-51c97621ccb1790cd125800af1add6a3c47c7869.zip
- bootloader:
o handle "alien" grub entries that will be kept verbatim (#23591)
-rw-r--r--perl-install/NEWS1
-rw-r--r--perl-install/bootloader.pm9
2 files changed, 8 insertions, 2 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index e2dfe4854..85e8dbf44 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -1,6 +1,7 @@
- bootloader:
o when reading existing menu.lst, keep verbatim entries for which the device
has no mount-point
+ o handle "alien" grub entries that will be kept verbatim (#23591)
o handle "root (hd...)" for menu.lst entries (#23591)
(nb: when writing, "root ..." will not be used)
- diskdrake:
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm
index b6f8a8938..fee1d22e1 100644
--- a/perl-install/bootloader.pm
+++ b/perl-install/bootloader.pm
@@ -239,6 +239,7 @@ sub read_grub_menu_lst {
-e $menu_lst_file or return;
foreach (cat_($menu_lst_file)) {
+ my $verbatim = $_;
chomp;
s/^\s*//; s/\s*$//;
next if /^#/ || /^$/;
@@ -273,6 +274,7 @@ sub read_grub_menu_lst {
$e->{$keyword} = $v eq '' ? 1 : $v;
}
}
+ $e and $e->{verbatim} .= $verbatim;
}
#- sanitize
@@ -288,6 +290,7 @@ sub read_grub_menu_lst {
$e->{append} = join(' ', grep { !/^BOOT_IMAGE=/ } split(' ', $e->{append}));
$e->{root} = $1 if $e->{append} =~ s/root=(\S*)\s*//;
$e->{kernel_or_dev} = grub2file($kernel, $grub2dev, $fstab, $e);
+ $e->{keep_verbatim} = 1 if dirname($e->{kernel_or_dev}) ne '/boot';
}
my ($vga, $other) = partition { /^vga=/ } split(' ', $e->{append});
if (@$vga) {
@@ -433,7 +436,7 @@ sub cleanup_entries {
#- cleanup bad entries (in case file is corrupted)
@{$bootloader->{entries}} =
grep {
- my $pb = $_->{type} eq 'image' && dirname($_->{kernel_or_dev}) eq '/boot' && ! -e "$::prefix$_->{kernel_or_dev}";
+ my $pb = $_->{type} eq 'image' && !$_->{keep_verbatim} && ! -e "$::prefix$_->{kernel_or_dev}";
log::l("dropping bootloader entry $_->{label} since $_->{kernel_or_dev} doesn't exist") if $pb;
!$pb;
} @{$bootloader->{entries}};
@@ -1600,7 +1603,9 @@ sub write_grub {
foreach my $entry (@{$bootloader->{entries}}) {
my $title = "\ntitle $entry->{label}";
- if ($entry->{type} eq "image") {
+ if ($entry->{keep_verbatim}) {
+ push @conf, '', $entry->{verbatim};
+ } elsif ($entry->{type} eq "image") {
push @conf, $title;
push @conf, grep { $entry->{$_} } 'lock';
push @conf, join(' ', 'kernel', $file2grub->($entry->{xen}), $entry->{xen_append}) if $entry->{xen};