diff options
-rw-r--r-- | perl-install/NEWS | 3 | ||||
-rwxr-xr-x | perl-install/standalone/bootloader-config | 26 |
2 files changed, 27 insertions, 2 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS index e06bb744e..a62372653 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -1,3 +1,6 @@ +- bootloader-config: + o do create /boot/initrd-xxx.img when there is no bootloader + (#30771 comment #21) - create udev nodes configuration file in /etc/udev/devices.d/ instead of conf.d (used for modem and mouse) - diskdrake: diff --git a/perl-install/standalone/bootloader-config b/perl-install/standalone/bootloader-config index 60afecd16..4010b1c73 100755 --- a/perl-install/standalone/bootloader-config +++ b/perl-install/standalone/bootloader-config @@ -61,8 +61,14 @@ if ($image) { my $all_hds = fsedit::get_hds(); fs::get_info_from_fstab($all_hds); -my $bootloader = bootloader::read($all_hds) or die "Cannot find a boot loader installed\n"; - +my $bootloader = bootloader::read($all_hds); +if (!$bootloader) { + if (member($action, 'add-kernel', 'remove-kernel')) { + warn "Cannot find a boot loader installed. Only taking care of initrd\n"; + } else { + die "Cannot find a boot loader installed\n"; + } +} $action =~ s/-/_/g; $::{$action}->(); @@ -81,6 +87,13 @@ sub remove_kernel() { unlink "/lib/modules/$kernel_version/source"; remove_now_broken_boot_symlinks(); + if (!$bootloader) { + #- removing the initrd for weird configs where no mdv bootloader is configured + my $kernel_str = bootloader::vmlinuz2kernel_str($image) or die "bad kernel name $image\n"; + unlink bootloader::kernel_str2initrd_long($kernel_str); + return; + } + my %proposed_labels; my @new_entries; @@ -124,6 +137,15 @@ sub add_kernel() { my $kernel_str = bootloader::vmlinuz2kernel_str($image) or die "bad kernel name $image\n"; + if (!$bootloader) { + #- building the initrd for weird configs where no mdv bootloader is configured + my $fake_bootloader = { vga => undef }; + my %opts = (initrd_options => $initrd_options); + my $initrd_long = bootloader::kernel_str2initrd_long($kernel_str); + bootloader::mkinitrd($kernel_str->{version}, $fake_bootloader, { %opts }, "/boot/$initrd_long"); + return; + } + my $root_part = fs::get::root([ fs::get::fstab($all_hds) ]) or die "can not find root partition\n"; my %opts = ( root => fs::wild_device::from_part('', $root_part), |