summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-09-19 13:36:16 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-09-19 13:36:16 +0000
commit4d0805d58380ee8645542919c7b3ea8b2be19114 (patch)
tree907fe6659e456df61696324105a0603340d12265 /perl-install
parent6c17ee01c53fa632bfebd514e5e20159ae439099 (diff)
downloaddrakx-4d0805d58380ee8645542919c7b3ea8b2be19114.tar
drakx-4d0805d58380ee8645542919c7b3ea8b2be19114.tar.gz
drakx-4d0805d58380ee8645542919c7b3ea8b2be19114.tar.bz2
drakx-4d0805d58380ee8645542919c7b3ea8b2be19114.tar.xz
drakx-4d0805d58380ee8645542919c7b3ea8b2be19114.zip
create _parse_grub_menu_lst() out of read_grub_menu_lst()
nb: no functional change. all computation using $fstab and $grub2dev are moved out of _parse_grub_menu_lst() to read_grub_menu_lst()
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/bootloader.pm27
1 files changed, 20 insertions, 7 deletions
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm
index cb0839598..1bc6a05ea 100644
--- a/perl-install/bootloader.pm
+++ b/perl-install/bootloader.pm
@@ -268,8 +268,7 @@ sub read_grub_install_sh() {
\%h;
}
-sub read_grub_menu_lst {
- my ($fstab, $grub2dev) = @_;
+sub _parse_grub_menu_lst() {
my $global = 1;
my ($e, %b);
@@ -293,21 +292,17 @@ sub read_grub_menu_lst {
push @{$b{entries}}, $e = { label => $v };
$global = 0;
} elsif ($global) {
- $b{$keyword} = $v eq '' ? 1 : grub2file($v, $grub2dev, $fstab, \%b);
+ $b{$keyword} = $v;
} else {
if ($keyword eq 'kernel') {
$e->{type} = 'image';
$e->{kernel} = $v;
} elsif ($keyword eq 'chainloader') {
$e->{type} = 'other';
- $e->{kernel_or_dev} = grub2dev($e->{rootnoverify} || $e->{grub_root}, $grub2dev);
$e->{append} = "";
} elsif ($keyword eq 'configfile') {
$e->{type} = 'grub_configfile';
- $e->{kernel_or_dev} = grub2dev($e->{rootnoverify} || $e->{grub_root}, $grub2dev);
$e->{configfile} = $v;
- } elsif ($keyword eq 'initrd') {
- $e->{initrd} = grub2file($v, $grub2dev, $fstab, $e);
} elsif ($keyword eq 'map') {
$e->{mapdrive}{$2} = $1 if $v =~ m/\((.*)\) \((.*)\)/;
} elsif ($keyword eq 'module') {
@@ -319,8 +314,26 @@ sub read_grub_menu_lst {
$e and $e->{verbatim} .= $verbatim;
}
+ %b;
+}
+
+sub read_grub_menu_lst {
+ my ($fstab, $grub2dev) = @_;
+
+ my %b = _parse_grub_menu_lst();
+
+ foreach my $keyword (grep { $_ ne 'entries' } keys %b) {
+ $b{$keyword} = $b{$keyword} eq '' ? 1 : grub2file($b{$keyword}, $grub2dev, $fstab, \%b);
+ }
+
#- sanitize
foreach my $e (@{$b{entries}}) {
+ if (member($e->{type}, 'chainloader', 'configfile')) {
+ $e->{kernel_or_dev} = grub2dev($e->{rootnoverify} || $e->{grub_root}, $grub2dev);
+ } elsif ($e->{initrd}) {
+ $e->{initrd} = grub2file($e->{initrd}, $grub2dev, $fstab, $e);
+ }
+
if ($e->{kernel} =~ /xen/ && @{$e->{modules} || []} == 2 && $e->{modules}[1] =~ /initrd/) {
(my $xen, $e->{xen_append}) = split(' ', $e->{kernel}, 2);
($e->{kernel}, my $initrd) = @{delete $e->{modules}};