From 7cd16e1b1c1ddd916e09ff19c742dec1aa754389 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Fri, 18 Mar 2005 15:21:07 +0000 Subject: handle grub file names that do not correspond to a mounted filesystem (bugzilla #14410) --- perl-install/bootloader.pm | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'perl-install/bootloader.pm') diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index 5c29cbc96..6049b7ee0 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -1200,9 +1200,13 @@ sub grub2dev { sub grub2file { my ($grub_file, $grub2dev, $fstab) = @_; if (my ($device, $rel_file) = grub2dev_and_file($grub_file, $grub2dev)) { - my $part = fs::get::device2part($device, $fstab) or log::l("ERROR: unknown device $device (computed from $grub_file)"); - my $mntpoint = $part->{mntpoint} || ''; - ($mntpoint eq '/' ? '' : $mntpoint) . '/' . $rel_file; + if (my $part = fs::get::device2part($device, $fstab)) { + my $mntpoint = $part->{mntpoint} || ''; + ($mntpoint eq '/' ? '' : $mntpoint) . '/' . $rel_file; + } else { + log::l("ERROR: unknown device $device (computed from $grub_file)"); + $grub_file; + } } else { $grub_file; } @@ -1222,8 +1226,13 @@ sub write_grub { } my $file2grub = sub { - my ($part, $file) = fs::get::file2part($fstab, $_[0], 'keep_simple_symlinks'); - device2grub($part, \@sorted_hds) . $file; + my ($file) = @_; + if ($file =~ m!^\(.*\)/!) { + $file; #- it's already in grub format + } else { + my ($part, $rel_file) = fs::get::file2part($fstab, $_[0], 'keep_simple_symlinks'); + device2grub($part, \@sorted_hds) . $rel_file; + } }; { my @conf; -- cgit v1.2.1