summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-03-21 16:30:16 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-03-21 16:30:16 +0000
commit5b24d850345c1f4e3053ab68827ccc2af90d3982 (patch)
tree7acdfc987cb85c659a77e42b25d075e3d9a8bf94
parent52102af9f98f888d876079182eed1fbc8c681ff2 (diff)
downloaddrakx-5b24d850345c1f4e3053ab68827ccc2af90d3982.tar
drakx-5b24d850345c1f4e3053ab68827ccc2af90d3982.tar.gz
drakx-5b24d850345c1f4e3053ab68827ccc2af90d3982.tar.bz2
drakx-5b24d850345c1f4e3053ab68827ccc2af90d3982.tar.xz
drakx-5b24d850345c1f4e3053ab68827ccc2af90d3982.zip
create parse_grub_file() out of grub2dev_and_file()
-rw-r--r--perl-install/bootloader.pm10
1 files changed, 8 insertions, 2 deletions
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm
index a9691938e..845674276 100644
--- a/perl-install/bootloader.pm
+++ b/perl-install/bootloader.pm
@@ -1526,10 +1526,16 @@ sub write_grub_device_map {
(map_index { "(hd$::i) /dev/$_->{device}\n" } @$sorted_hds));
}
-sub grub2dev_and_file {
- my ($grub_file, $grub2dev, $o_block_device) = @_;
+sub parse_grub_file {
+ my ($grub_file) = @_;
my ($grub_dev, $rel_file) = $grub_file =~ m!\((.*?)\)/?(.*)! or return;
my ($hd, $part) = split(',', $grub_dev);
+ ($hd, $part, $rel_file);
+}
+
+sub grub2dev_and_file {
+ my ($grub_file, $grub2dev, $o_block_device) = @_;
+ my ($hd, $part, $rel_file) = parse_grub_file($grub_file) or return;
$grub2dev->{$hd} or internal_error("$hd has no mapping in device.map (when translating $grub_file)");
$part = $o_block_device ? '' : defined $part && $part + 1; #- grub wants "(hdX,Y)" where lilo just want "hdY+1"
my $device = '/dev/' . $grub2dev->{$hd} . $part;