diff options
Diffstat (limited to 'perl-install/bootloader.pm')
-rw-r--r-- | perl-install/bootloader.pm | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index 0cdbfc1bd..6429cb00a 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -39,6 +39,21 @@ our %vga_modes = ( #-##################################################################################### #- Functions #-##################################################################################### +my $vmlinuz_regexp = 'vmlinuz|win4lin'; +my $decompose_vmlinuz_name = qr/((?:$vmlinuz_regexp).*?)-(\d+\.\d+.*)/; + +sub expand_vmlinuz_symlink { + my ($vmlinuz) = @_; + my $f = $::prefix . ($vmlinuz =~ m!^/! ? $vmlinuz : "/boot/$vmlinuz"); + -l $f ? readlink($f) : $vmlinuz; +} + +sub installed_vmlinuz_raw() { grep { /^($vmlinuz_regexp)/ } all("$::prefix/boot") } +sub installed_vmlinuz() { grep { ! -l "$::prefix/boot/$_" } installed_vmlinuz_raw() } +sub vmlinuz2version { + my ($vmlinuz) = @_; + expand_vmlinuz_symlink($vmlinuz) =~ /$decompose_vmlinuz_name/ && $2; +} sub get { my ($kernel, $bootloader) = @_; @@ -658,18 +673,21 @@ sub detect_bootloader() { sub method_choices { my ($fstab, $bootloader) = @_; - my %choices = ( - if_(arch() =~ /sparc/, + my %choices = + arch() =~ /sparc/ ? ( 'silo' => N("SILO"), - ), if_(arch() !~ /sparc|ppc/ && !isLoopback(fsedit::get_root($fstab)) && whereis_binary('lilo'), - if_(!detect_devices::matching_desc('ProSavageDDR'), 'lilo-graphic' => N("LILO with graphical menu")), - 'lilo-menu' => N("LILO with text menu"), - ), if_(arch() !~ /sparc|ppc/ && !isRAID(fsedit::get_root($fstab)) && whereis_binary('grub'), - 'grub' => N("Grub"), - ), if_(arch() =~ /ppc/, + ) : arch() =~ /ppc/ ? ( 'yaboot' => N("Yaboot"), - ), - ); + ) : arch() =~ /ia64/ ? ( + 'lilo' => N("Elilo"), + ) : ( + if_(!isLoopback(fsedit::get_root($fstab)) && whereis_binary('lilo'), + if_(!detect_devices::matching_desc('ProSavageDDR'), 'lilo-graphic' => N("LILO with graphical menu")), + 'lilo-menu' => N("LILO with text menu"), + ), if_(!isRAID(fsedit::get_root($fstab)) && whereis_binary('grub'), + 'grub' => N("Grub"), + ), + ); my $prefered; $prefered ||= 'grub' if $::isStandalone && detect_bootloader() =~ /GRUB/; $prefered ||= 'lilo-' . (member($bootloader->{install}, 'text', 'menu', 'graphic') ? $bootloader->{install} : 'graphic'); @@ -1152,10 +1170,8 @@ sub install_grub { if (!$::testing) { log::l("Installing boot loader..."); - symlink "$::prefix/boot", "/boot"; my $error; - run_program::run("sh", $f, "2>", \$error) or die "grub failed: $error"; - unlink "/boot"; + run_program::rooted($::prefix, "sh", $f, "2>", \$error) or die "grub failed: $error"; } } |