Mageia Bugzilla – Attachment 8016 Details for
Bug 16918
grub's device.map is bogusly modified on kernel upgrades (hard drives: disorder in numbering)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
[patch]
grub: only overwrite install.sh when installing
0002-grub-only-overwrite-install.sh-when-installing.patch (text/plain), 2.56 KB, created by
Thierry Vignaud
on 2016-06-17 14:43:35 CEST
(
hide
)
Description:
grub: only overwrite install.sh when installing
Filename:
MIME Type:
Creator:
Thierry Vignaud
Created:
2016-06-17 14:43:35 CEST
Size:
2.56 KB
patch
obsolete
>From 48ee317732ca1b25cb08a2037f4aed7c7ba6b28c Mon Sep 17 00:00:00 2001 >From: Thierry Vignaud <thierry.vignaud@gmail.com> >Date: Fri, 17 Jun 2016 14:40:15 +0200 >Subject: [PATCH 2/2] grub: only overwrite install.sh when installing > >And only when actually installing boot loader, not when updating grub >menu list (mga#16918) >--- > perl-install/bootloader.pm | 32 +++++++++++++++++++------------- > 1 file changed, 19 insertions(+), 13 deletions(-) > >diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm >index 5e9ced5..02bb6d3 100644 >--- a/perl-install/bootloader.pm >+++ b/perl-install/bootloader.pm >@@ -1854,6 +1854,23 @@ sub write_grub2_install_sh { > output_with_perm($f, 0755, join(' ', 'grub2-install', @options)); > } > >+sub write_grub_install_sh { >+ my ($bootloader, $o_backup_extension, $fstab, $legacy_floppies, $sorted_hds) = @_; >+ >+ my $f = "$::prefix/boot/grub/install.sh"; >+ my $boot_dev = device_string2grub($bootloader->{boot}, $legacy_floppies, $sorted_hds); >+ my $files_dev = device2grub(fs::get::root_($fstab, 'boot'), $sorted_hds); >+ renamef($f, $f . ($o_backup_extension || '.old')); >+ output_with_perm($f, 0755, >+"grub --device-map=/boot/grub/device.map --batch <<EOF >+root $files_dev >+setup --stage2=/boot/grub/stage2 $boot_dev >+quit >+EOF >+"); >+} >+ >+ > sub write_grub { > my ($bootloader, $all_hds, $o_backup_extension) = @_; > >@@ -1988,19 +2005,6 @@ sub write_grub { > renamef($f, $f . ($o_backup_extension || '.old')); > output_with_perm($f, 0600, map { "$_\n" } @conf); > } >- { >- my $f = "$::prefix/boot/grub/install.sh"; >- my $boot_dev = device_string2grub($bootloader->{boot}, \@legacy_floppies, \@sorted_hds); >- my $files_dev = device2grub(fs::get::root_($fstab, 'boot'), \@sorted_hds); >- renamef($f, $f . ($o_backup_extension || '.old')); >- output_with_perm($f, 0755, >-"grub --device-map=/boot/grub/device.map --batch <<EOF >-root $files_dev >-setup --stage2=/boot/grub/stage2 $boot_dev >-quit >-EOF >-"); >- } > > check_enough_space(); > } >@@ -2064,11 +2068,13 @@ sub install_raw_grub2() { > sub install_grub { > my ($bootloader, $all_hds) = @_; > >+ my $fstab = [ fs::get::fstab($all_hds) ]; > my @legacy_floppies = detect_devices::floppies(); > my @sorted_hds = sort_hds_according_to_bios($bootloader, $all_hds); > write_grub_device_map(\@legacy_floppies, \@sorted_hds); > > write_grub($bootloader, $all_hds); >+ write_grub_install_sh($bootloader, $all_hds, $fstab, \@legacy_floppies, \@sorted_hds); > > if (!$::testing) { > if ($bootloader->{previous_boot} && $bootloader->{previous_boot} eq $bootloader->{boot}) { >-- >2.9.0 >
From 48ee317732ca1b25cb08a2037f4aed7c7ba6b28c Mon Sep 17 00:00:00 2001 From: Thierry Vignaud <thierry.vignaud@gmail.com> Date: Fri, 17 Jun 2016 14:40:15 +0200 Subject: [PATCH 2/2] grub: only overwrite install.sh when installing And only when actually installing boot loader, not when updating grub menu list (mga#16918) --- perl-install/bootloader.pm | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index 5e9ced5..02bb6d3 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -1854,6 +1854,23 @@ sub write_grub2_install_sh { output_with_perm($f, 0755, join(' ', 'grub2-install', @options)); } +sub write_grub_install_sh { + my ($bootloader, $o_backup_extension, $fstab, $legacy_floppies, $sorted_hds) = @_; + + my $f = "$::prefix/boot/grub/install.sh"; + my $boot_dev = device_string2grub($bootloader->{boot}, $legacy_floppies, $sorted_hds); + my $files_dev = device2grub(fs::get::root_($fstab, 'boot'), $sorted_hds); + renamef($f, $f . ($o_backup_extension || '.old')); + output_with_perm($f, 0755, +"grub --device-map=/boot/grub/device.map --batch <<EOF +root $files_dev +setup --stage2=/boot/grub/stage2 $boot_dev +quit +EOF +"); +} + + sub write_grub { my ($bootloader, $all_hds, $o_backup_extension) = @_; @@ -1988,19 +2005,6 @@ sub write_grub { renamef($f, $f . ($o_backup_extension || '.old')); output_with_perm($f, 0600, map { "$_\n" } @conf); } - { - my $f = "$::prefix/boot/grub/install.sh"; - my $boot_dev = device_string2grub($bootloader->{boot}, \@legacy_floppies, \@sorted_hds); - my $files_dev = device2grub(fs::get::root_($fstab, 'boot'), \@sorted_hds); - renamef($f, $f . ($o_backup_extension || '.old')); - output_with_perm($f, 0755, -"grub --device-map=/boot/grub/device.map --batch <<EOF -root $files_dev -setup --stage2=/boot/grub/stage2 $boot_dev -quit -EOF -"); - } check_enough_space(); } @@ -2064,11 +2068,13 @@ sub install_raw_grub2() { sub install_grub { my ($bootloader, $all_hds) = @_; + my $fstab = [ fs::get::fstab($all_hds) ]; my @legacy_floppies = detect_devices::floppies(); my @sorted_hds = sort_hds_according_to_bios($bootloader, $all_hds); write_grub_device_map(\@legacy_floppies, \@sorted_hds); write_grub($bootloader, $all_hds); + write_grub_install_sh($bootloader, $all_hds, $fstab, \@legacy_floppies, \@sorted_hds); if (!$::testing) { if ($bootloader->{previous_boot} && $bootloader->{previous_boot} eq $bootloader->{boot}) { -- 2.9.0
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 16918
:
8015
| 8016