summaryrefslogtreecommitdiffstats
path: root/perl-install/bootloader.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-07-26 18:56:05 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-07-26 18:56:05 +0000
commitf263756d54a52b6618a9303df3400bec943b1272 (patch)
tree7605b3087f3ceb5c885afb31adce440734829d4d /perl-install/bootloader.pm
parentd88f662079e5eef78dcd25cf6a18771567af02e8 (diff)
downloaddrakx-f263756d54a52b6618a9303df3400bec943b1272.tar
drakx-f263756d54a52b6618a9303df3400bec943b1272.tar.gz
drakx-f263756d54a52b6618a9303df3400bec943b1272.tar.bz2
drakx-f263756d54a52b6618a9303df3400bec943b1272.tar.xz
drakx-f263756d54a52b6618a9303df3400bec943b1272.zip
- fix dying when mkinitrd doesn't create an initrd
- cleanup
Diffstat (limited to 'perl-install/bootloader.pm')
-rw-r--r--perl-install/bootloader.pm25
1 files changed, 15 insertions, 10 deletions
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm
index 30ad4ea4d..256e9c743 100644
--- a/perl-install/bootloader.pm
+++ b/perl-install/bootloader.pm
@@ -59,11 +59,13 @@ sub mkinitrd($$$) {
my $loop_boot = loopback::prepare_boot($prefix);
modules::load('loop');
- run_program::rooted($prefix, "mkinitrd", "-v", "-f", $initrdImage, "--ifneeded", $kernelVersion) or unlink("$prefix/$initrdImage");
-
+ if (!run_program::rooted($prefix, "mkinitrd", "-v", "-f", $initrdImage, "--ifneeded", $kernelVersion)) {
+ unlink("$prefix/$initrdImage");
+ die "mkinitrd failed";
+ }
loopback::save_boot($loop_boot);
- -e "$prefix/$initrdImage" or die "mkinitrd failed";
+ -e "$prefix/$initrdImage";
}
sub mkbootdisk($$$;$) {
@@ -168,11 +170,14 @@ sub add_kernel {
-e "$prefix/boot/vmlinuz-$version" or log::l("unable to find kernel image $prefix/boot/vmlinuz-$version"), return;
my $image = "/boot/vmlinuz" . ($ext ne "-$version" &&
symlinkf("vmlinuz-$version", "$prefix/boot/vmlinuz$ext") ? $ext : "-$version");
- my $initrd = do {
- mkinitrd($prefix, $version, "/boot/initrd-$version.img");
- "/boot/initrd" . ($ext ne "-$version" &&
- symlinkf("initrd-$version.img", "$prefix/boot/initrd$ext.img") ? $ext : "-$version") . ".img";
- };
+
+ my $initrd = "/boot/initrd-$version.img";
+ mkinitrd($prefix, $version, $initrd) or undef $initrd;
+ if ($initrd && $ext ne "-$version") {
+ $initrd = "/boot/initrd$ext.img";
+ symlinkf("initrd-$version.img", "$prefix$initrd");
+ }
+
my $label = $ext =~ /-(default)/ ? $1 : "linux$ext";
#- more yaboot concessions - PPC
@@ -241,7 +246,7 @@ sub configure_entry($$) {
if ($specific_version) {
$entry->{initrd} or $entry->{initrd} = "/boot/initrd-$specific_version.img";
- mkinitrd($prefix, $specific_version, $entry->{initrd});
+ mkinitrd($prefix, $specific_version, $entry->{initrd}) or undef $entry->{initrd};
}
}
$entry;
@@ -686,7 +691,7 @@ sub write_lilo_conf {
(my $part, $file) = fsedit::file2part($prefix, $fstab, $file);
my %hds = map_index { $_ => "hd$::i" } map { $_->{device} }
sort { isFat($b) <=> isFat($a) || $a->{device} cmp $b->{device} } fsedit::get_fstab(@$hds);
- %hds->{$part->{device}} . ":" . $file;
+ $hds->{$part->{device}} . ":" . $file;
} else {
$file
}