summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-12-07 11:35:00 +0000
committerThierry Vignaud <tv@mageia.org>2012-12-07 11:35:00 +0000
commit8c19d06b2710d536e4134ed1c42d6ac3ff026866 (patch)
treeeb0e2661a430067592c32d46d2e73f4b007fb8fa /perl-install
parenteeb09fdeb2c70b236317514be43f0baf245798e9 (diff)
downloaddrakx-8c19d06b2710d536e4134ed1c42d6ac3ff026866.tar
drakx-8c19d06b2710d536e4134ed1c42d6ac3ff026866.tar.gz
drakx-8c19d06b2710d536e4134ed1c42d6ac3ff026866.tar.bz2
drakx-8c19d06b2710d536e4134ed1c42d6ac3ff026866.tar.xz
drakx-8c19d06b2710d536e4134ed1c42d6ac3ff026866.zip
add support for Grub2 when installing/removing kernels
(from rosa but fixed) (also way incomplete...)
Diffstat (limited to 'perl-install')
-rwxr-xr-xperl-install/standalone/bootloader-config43
1 files changed, 32 insertions, 11 deletions
diff --git a/perl-install/standalone/bootloader-config b/perl-install/standalone/bootloader-config
index 747dbb179..4f543131e 100755
--- a/perl-install/standalone/bootloader-config
+++ b/perl-install/standalone/bootloader-config
@@ -61,12 +61,16 @@ if ($image) {
my $all_hds = fsedit::get_hds();
fs::get_info_from_fstab($all_hds);
-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";
+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";
+ }
}
}
@@ -87,6 +91,12 @@ 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
my $kernel_str = bootloader::vmlinuz2kernel_str($image) or die "bad kernel name $image\n";
@@ -157,12 +167,17 @@ sub add_kernel() {
if_($label, label => $label),
(grep_each { member($::a, 'vga', 'lock') } %{$bootloader->{default_options}}),
);
- #- 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);
+ 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();
}
@@ -179,6 +194,12 @@ 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);