Mageia Bugzilla – Attachment 5933 Details for
Bug 15153
Patches to add support for the rEFInd boot manager in drakboot
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
[patch]
Patch for /lib/libDrakX/bootloader.pm
bootloader.pm.mga5.patch (text/plain), 3.10 KB, created by
Martin Whitaker
on 2015-02-21 17:34:24 CET
(
hide
)
Description:
Patch for /lib/libDrakX/bootloader.pm
Filename:
MIME Type:
Creator:
Martin Whitaker
Created:
2015-02-21 17:34:24 CET
Size:
3.10 KB
patch
obsolete
>--- bootloader.pm.orig 2015-02-10 19:08:21.000000000 +0000 >+++ bootloader.pm 2015-02-21 15:24:23.108133789 +0000 >@@ -251,6 +251,8 @@ > } elsif (my $type = partition_table::raw::typeOfMBR($_)) { > warn "typeOfMBR $type on $_ for method $main_method\n" if $ENV{DEBUG}; > $type; >+ } elsif (-e "/boot/EFI/EFI/refind" && -e "$::prefix/boot/refind_linux.conf") { >+ 'refind'; > } else { () } > } @devs; > >@@ -511,6 +513,35 @@ > \%b; > } > >+=item read_refind ($fstab) >+ >+Read back rEFInd config + C</boot/refind_linux.conf> >+ >+=cut >+ >+sub read_refind { >+ my (%bootloader, $entry); >+ $bootloader{entries} = []; >+ foreach (cat_utf8("$::prefix/boot/refind_linux.conf")) { >+ next if /^#/; >+ (my $label, my $append) = ($_ =~ /"(.*)"\s"(.*)"/); >+ my $root = $1 if $append =~ s/root=(\S*)\s*//; >+ my $vga = $1 if $append =~ s/vga=(\S*)\s*//; >+ if ($label && $root) { >+ $entry = {type => 'image'}; >+ $entry->{kernel_or_dev} = '/boot/vmlinuz'; >+ $entry->{label} = $label; >+ $entry->{root} = $root; >+ $entry->{append} = $append; >+ $entry->{vga} = $vga; >+ push @{$bootloader{entries}}, $entry; >+ } >+ } >+ >+ $bootloader{method} = 'refind'; >+ \%bootloader; >+} >+ > # FIXME: actually read back previous conf > sub read_pmon2000() { > +{ method => 'pmon2000' }; >@@ -1245,6 +1276,7 @@ > 'grub2' => N("GRUB2 with graphical menu"), > 'grub-graphic' => N("GRUB with graphical menu"), > 'grub-menu' => N("GRUB with text menu"), >+ 'refind' => N("rEFInd"), > }->{$method}; > } > >@@ -1255,6 +1287,10 @@ > arch() =~ /arm/ ? 'uboot' : > if_(!$b_prefix_mounted || whereis_binary('grub2-reboot', $::prefix), > 'grub2'), >+ if_(is_uefi(), ( >+ if_(!$b_prefix_mounted || -e "/boot/EFI/EFI/refind", >+ 'refind'), >+ )), > if_(!is_uefi(), ( > if_(!$b_prefix_mounted || whereis_binary('grub', $::prefix), > 'grub-graphic', 'grub-menu'), >@@ -2017,6 +2053,44 @@ > update_copy_in_boot($_) foreach glob($::prefix . boot_copies_dir() . '/*.link'); > } > >+sub write_refind { >+ my ($bootloader, $all_hds, $o_backup_extension) = @_; >+ >+ my @conf; >+ >+ foreach my $entry (@{$bootloader->{entries}}) { >+ my $title = "\"$entry->{label}"; >+ >+ if ($entry->{type} eq "image" && $entry->{kernel_or_dev} eq "/boot/vmlinuz") { >+ my $vga = $entry->{vga} || $bootloader->{vga}; >+ my $boot_params = join(' ', >+ "root=$entry->{root}", >+ $entry->{append}, >+ if_($entry->{'read-write'}, 'rw'), >+ if_($vga && $vga ne "normal", "vga=$vga") >+ ); >+ push @conf, '"' . simplify_label($entry->{label}) . '" "' . $boot_params . '"'; >+ } >+ } >+ my $f = "$::prefix/boot/refind_linux.conf"; >+ log::l("writing rEFInd config to $f"); >+ renamef($f, $f . ($o_backup_extension || '.old')); >+ output_with_perm($f, 0600, map { "$_\n" } @conf); >+ >+ check_enough_space(); >+} >+ >+sub install_refind { >+ my ($bootloader, $all_hds) = @_; >+ >+ write_refind($bootloader, $all_hds); >+} >+ >+sub when_config_changed_refind { >+ my ($_bootloader) = @_; >+ #- do not do anything >+} >+ > =item action($bootloader, $action, @para) > > Calls the C<$action> function with @para parameters:
--- bootloader.pm.orig 2015-02-10 19:08:21.000000000 +0000 +++ bootloader.pm 2015-02-21 15:24:23.108133789 +0000 @@ -251,6 +251,8 @@ } elsif (my $type = partition_table::raw::typeOfMBR($_)) { warn "typeOfMBR $type on $_ for method $main_method\n" if $ENV{DEBUG}; $type; + } elsif (-e "/boot/EFI/EFI/refind" && -e "$::prefix/boot/refind_linux.conf") { + 'refind'; } else { () } } @devs; @@ -511,6 +513,35 @@ \%b; } +=item read_refind ($fstab) + +Read back rEFInd config + C</boot/refind_linux.conf> + +=cut + +sub read_refind { + my (%bootloader, $entry); + $bootloader{entries} = []; + foreach (cat_utf8("$::prefix/boot/refind_linux.conf")) { + next if /^#/; + (my $label, my $append) = ($_ =~ /"(.*)"\s"(.*)"/); + my $root = $1 if $append =~ s/root=(\S*)\s*//; + my $vga = $1 if $append =~ s/vga=(\S*)\s*//; + if ($label && $root) { + $entry = {type => 'image'}; + $entry->{kernel_or_dev} = '/boot/vmlinuz'; + $entry->{label} = $label; + $entry->{root} = $root; + $entry->{append} = $append; + $entry->{vga} = $vga; + push @{$bootloader{entries}}, $entry; + } + } + + $bootloader{method} = 'refind'; + \%bootloader; +} + # FIXME: actually read back previous conf sub read_pmon2000() { +{ method => 'pmon2000' }; @@ -1245,6 +1276,7 @@ 'grub2' => N("GRUB2 with graphical menu"), 'grub-graphic' => N("GRUB with graphical menu"), 'grub-menu' => N("GRUB with text menu"), + 'refind' => N("rEFInd"), }->{$method}; } @@ -1255,6 +1287,10 @@ arch() =~ /arm/ ? 'uboot' : if_(!$b_prefix_mounted || whereis_binary('grub2-reboot', $::prefix), 'grub2'), + if_(is_uefi(), ( + if_(!$b_prefix_mounted || -e "/boot/EFI/EFI/refind", + 'refind'), + )), if_(!is_uefi(), ( if_(!$b_prefix_mounted || whereis_binary('grub', $::prefix), 'grub-graphic', 'grub-menu'), @@ -2017,6 +2053,44 @@ update_copy_in_boot($_) foreach glob($::prefix . boot_copies_dir() . '/*.link'); } +sub write_refind { + my ($bootloader, $all_hds, $o_backup_extension) = @_; + + my @conf; + + foreach my $entry (@{$bootloader->{entries}}) { + my $title = "\"$entry->{label}"; + + if ($entry->{type} eq "image" && $entry->{kernel_or_dev} eq "/boot/vmlinuz") { + my $vga = $entry->{vga} || $bootloader->{vga}; + my $boot_params = join(' ', + "root=$entry->{root}", + $entry->{append}, + if_($entry->{'read-write'}, 'rw'), + if_($vga && $vga ne "normal", "vga=$vga") + ); + push @conf, '"' . simplify_label($entry->{label}) . '" "' . $boot_params . '"'; + } + } + my $f = "$::prefix/boot/refind_linux.conf"; + log::l("writing rEFInd config to $f"); + renamef($f, $f . ($o_backup_extension || '.old')); + output_with_perm($f, 0600, map { "$_\n" } @conf); + + check_enough_space(); +} + +sub install_refind { + my ($bootloader, $all_hds) = @_; + + write_refind($bootloader, $all_hds); +} + +sub when_config_changed_refind { + my ($_bootloader) = @_; + #- do not do anything +} + =item action($bootloader, $action, @para) Calls the C<$action> function with @para parameters:
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 15153
:
5844
|
5845
|
5932
|
5933
|
5936
|
5975
|
6187
|
6188
|
6308
|
8124
|
8125
|
8126
|
8127
|
8128
|
10371