summaryrefslogtreecommitdiffstats
path: root/perl-install/bootloader.pm
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mandriva.org>2009-04-15 15:52:56 +0000
committerPascal Terjan <pterjan@mandriva.org>2009-04-15 15:52:56 +0000
commitc6c642082270cc73e527b0b1973d0f9ae166265c (patch)
tree68549963c8db91fdb7c8f6cfc58bf02ec25f73d8 /perl-install/bootloader.pm
parent6c92b92d5891b2f7b05a2ce8e1a341427dce230a (diff)
downloaddrakx-c6c642082270cc73e527b0b1973d0f9ae166265c.tar
drakx-c6c642082270cc73e527b0b1973d0f9ae166265c.tar.gz
drakx-c6c642082270cc73e527b0b1973d0f9ae166265c.tar.bz2
drakx-c6c642082270cc73e527b0b1973d0f9ae166265c.tar.xz
drakx-c6c642082270cc73e527b0b1973d0f9ae166265c.zip
keep grub entries which refer to unknown devices verbatim instead of crashing (#48728)
Diffstat (limited to 'perl-install/bootloader.pm')
-rw-r--r--perl-install/bootloader.pm15
1 files changed, 11 insertions, 4 deletions
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm
index c816baed6..b6dcb9770 100644
--- a/perl-install/bootloader.pm
+++ b/perl-install/bootloader.pm
@@ -335,9 +335,16 @@ sub read_grub_menu_lst {
#- sanitize
foreach my $e (@{$b{entries}}) {
if (member($e->{type}, 'other', 'grub_configfile')) {
- $e->{kernel_or_dev} = grub2dev($e->{rootnoverify} || $e->{grub_root}, $grub2dev);
+ eval { $e->{kernel_or_dev} = grub2dev($e->{rootnoverify} || $e->{grub_root}, $grub2dev); }
+ $e->{keep_verbatim} = 1 unless $e->{kernel_or_dev};
} elsif ($e->{initrd}) {
- $e->{initrd} = grub2file($e->{initrd}, $grub2dev, $fstab, $e);
+ my $initrd;
+ eval { $initrd = grub2file($e->{initrd}, $grub2dev, $fstab, $e)};
+ if ($initrd) {
+ $e->{initrd} = $initrd;
+ } else {
+ $e->{keep_verbatim} = 1;
+ }
}
if ($e->{kernel} =~ /xen/ && @{$e->{modules} || []} == 2 && $e->{modules}[1] =~ /initrd/) {
@@ -350,8 +357,8 @@ sub read_grub_menu_lst {
(my $kernel, $e->{append}) = split(' ', $v, 2);
$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';
+ eval { $e->{kernel_or_dev} = grub2file($kernel, $grub2dev, $fstab, $e) };
+ $e->{keep_verbatim} = 1 unless $e->{kernel_or_dev} && dirname($e->{kernel_or_dev}) eq '/boot';
}
my ($vga, $other) = partition { /^vga=/ } split(' ', $e->{append});
if (@$vga) {