summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/bootloader-config
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/standalone/bootloader-config')
-rwxr-xr-xperl-install/standalone/bootloader-config46
1 files changed, 14 insertions, 32 deletions
diff --git a/perl-install/standalone/bootloader-config b/perl-install/standalone/bootloader-config
index ef9e10a16..9b6a021de 100755
--- a/perl-install/standalone/bootloader-config
+++ b/perl-install/standalone/bootloader-config
@@ -61,16 +61,15 @@ if ($image) {
my $all_hds = fsedit::get_hds();
fs::get_info_from_fstab($all_hds);
-my $have_grub2 = -e "/boot/grub2/grub.cfg"; # FIXME: check detectloader
-my $bootloader;
-if (!$have_grub2) {
- $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";
- }
+my $bootloader = bootloader::read($all_hds);
+if (!$bootloader) {
+ if (member($action, 'add-kernel', 'remove-kernel')) {
+ if ($no_initrd) {
+ die "Cannot find a bootloader installed and initrd build suppressed\n";
+ }
+ warn "Cannot find a boot loader installed. Only taking care of initrd\n";
+ } else {
+ die "Cannot find a boot loader installed\n";
}
}
@@ -91,14 +90,8 @@ sub remove_kernel() {
unlink "/lib/modules/$kernel_version/source";
remove_now_broken_boot_symlinks();
- if ($have_grub2) {
- system('grub2-mkconfig', '-o', '/boot/grub2/grub.cfg');
- modify_bootloader();
- return;
- }
-
if (!$bootloader) {
- #- removing the initrd for weird configs where no mdv bootloader is configured
+ #- removing the initrd for weird configs where no mga bootloader is configured
my $kernel_str = bootloader::vmlinuz2kernel_str($image) or die "bad kernel name $image\n";
my $initrd_long = bootloader::kernel_str2initrd_long($kernel_str);
unlink "/boot/$initrd_long";
@@ -147,20 +140,20 @@ sub remove_kernel() {
#-###############################################################################
sub add_kernel() {
configure_ide_controller();
- bootloader::create_link_source();
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
+ #- building the initrd for weird configs where no mga 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");
+ 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 "cannot find root partition\n";
+ my $root_part = fs::get::root_([ fs::get::fstab($all_hds) ]) or warn "cannot find root partition in /etc/fstab\n";
+ $root_part ||= fs::get::root_from_mounted() or die "cannot find root partition\n";
my %opts = (
root => fs::wild_device::from_part('', $root_part),
initrd_options => $initrd_options,
@@ -168,16 +161,12 @@ sub add_kernel() {
(grep_each { member($::a, 'vga', 'lock') } %{$bootloader->{default_options}}),
);
- if ($have_grub2) {
- system('grub2-mkconfig', '-o', '/boot/grub2/grub.cfg');
- } else {
#- short name
bootloader::add_kernel($bootloader, $kernel_str, { %opts }, 0, $no_initrd) if !$no_short_name;
#- long name
$kernel_str->{use_long_name} = 1;
bootloader::add_kernel($bootloader, $kernel_str, { %opts }, 1, $no_initrd);
- }
modify_bootloader();
}
@@ -194,12 +183,6 @@ sub configure_ide_controller() {
}
sub modify_bootloader() {
- if ($have_grub2) {
- my $boot_partition = `df -h /boot |(read; awk '{print \$1; exit}'|sed 's/[[:digit:]]*\$//')`;
- system('grub2-install', $boot_partition);
- return;
- }
-
!$no_entry or return;
bootloader::action($bootloader, 'write', $all_hds);
@@ -372,6 +355,5 @@ sub remove_splash() {
}
sub detectloader() {
- print "grub2\n" if $have_grub2;
print uc(bootloader::main_method($bootloader->{method})), "\n" if $bootloader;
}