From 4f7197a536b57f1ff65e5e6f5cc4e0b9cbc28824 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 18 Aug 2004 09:02:42 +0000 Subject: - any::setupBootloader() used to call bootloader::install() whereas install_steps_interactive::setupBootloader() could call it once again (but this code seems dead though) - create any::installBootloader() out of what was done in the end of any::setupBootloader() but also in install_steps_interactive and drakboot (which handled the error that could occur in bootloader::install()) --- perl-install/any.pm | 27 ++++++++++++++++++++++----- perl-install/install_steps_interactive.pm | 22 +++++----------------- perl-install/standalone/drakboot | 21 ++++++--------------- 3 files changed, 33 insertions(+), 37 deletions(-) (limited to 'perl-install') diff --git a/perl-install/any.pm b/perl-install/any.pm index df244b8ff..c7fcea887 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -101,15 +101,32 @@ sub setupBootloader { local $::Wizard_finished = 1 if $::isStandalone; setupBootloader__entries($in, $b, $all_hds, $fstab) or goto general; } +} - #- somewhere should bootloader really installed ? - $::isStandalone and my $_w = $in->wait_message(N("Please wait"), N("Bootloader installation in progress")); +sub installBootloader { + my ($in, $b, $all_hds) = @_; - eval { run_program::rooted($::prefix, 'lilo', '-u') } if $::isInstall && !$::o->{isUpgrade} && -e "$::prefix/etc/lilo.conf" && glob("$::prefix/boot/boot.*"); + install_acpi_pkgs($in, $b); + + my $_w = $in->wait_message(N("Please wait"), N("Bootloader installation in progress")); - install_acpi_pkgs($in->do_pkgs, $b); + eval { run_program::rooted($::prefix, 'lilo', '-u') } if $::isInstall && !$::o->{isUpgrade} && -e "$::prefix/etc/lilo.conf" && glob("$::prefix/boot/boot.*"); - bootloader::install($b, $all_hds); + eval { bootloader::install($b, $all_hds) }; + + if (my $err = $@) { + $err =~ /wizcancel/ and return; + $err =~ s/^\w+ failed// or die; + $err = formatError($err); + while ($err =~ s/^Warning:.*//m) {} + $o->ask_warn('', [ N("Installation of bootloader failed. The following error occured:"), $err ]); + return; + } elsif (arch() =~ /ppc/) { + my $of_boot = cat_("$o->{prefix}/tmp/of_boot_dev") || die "Can't open $o->{prefix}/tmp/of_boot_dev"; + chop($of_boot); + $o->ask_warn('', N("You may need to change your Open Firmware boot-device to\n enable the bootloader. If you don't see the bootloader prompt at\n reboot, hold down Command-Option-O-F at reboot and enter:\n setenv boot-device %s,\\\\:tbxi\n Then type: shut-down\nAt your next boot you should see the bootloader prompt.", $of_boot)); + } + 1; } diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index b547b138d..6b7c69723 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -1080,7 +1080,10 @@ sub summary { #-PO: example: lilo-graphic on /dev/hda1 N("%s on %s", $o->{bootloader}{method}, $o->{bootloader}{boot}) }, - clicked => sub { any::setupBootloader($o, $o->{bootloader}, $o->{all_hds}, $o->{fstab}, $o->{security}) }, + clicked => sub { + any::setupBootloader($o, $o->{bootloader}, $o->{all_hds}, $o->{fstab}, $o->{security}); + any::installBootloader($o, $o->{bootloader}, $o->{all_hds}); + }, }; push @l, { @@ -1234,22 +1237,7 @@ try to force installation even if that destroys the first partition?")); } else { any::setupBootloader($o, $o->{bootloader}, $o->{all_hds}, $o->{fstab}, $o->{security}) or return; } - - { - my $_w = $o->wait_message('', N("Installing bootloader")); - eval { $o->SUPER::setupBootloader }; - } - if (my $err = $@) { - $err =~ s/^\w+ failed// or die; - $err = formatError($err); - while ($err =~ s/^Warning:.*//m) {} - $o->ask_warn('', [ N("Installation of bootloader failed. The following error occured:"), $err ]); - die "already displayed"; - } elsif (arch() =~ /ppc/) { - my $of_boot = cat_("$o->{prefix}/tmp/of_boot_dev") || die "Can't open $o->{prefix}/tmp/of_boot_dev"; - chop($of_boot); - $o->ask_warn('', N("You may need to change your Open Firmware boot-device to\n enable the bootloader. If you don't see the bootloader prompt at\n reboot, hold down Command-Option-O-F at reboot and enter:\n setenv boot-device %s,\\\\:tbxi\n Then type: shut-down\nAt your next boot you should see the bootloader prompt.", $of_boot)); - } + any::installBootloader($o, $o->{bootloader}, $o->{all_hds}) or die "already displayed"; } } diff --git a/perl-install/standalone/drakboot b/perl-install/standalone/drakboot index 2e077eca4..5a66f3de4 100755 --- a/perl-install/standalone/drakboot +++ b/perl-install/standalone/drakboot @@ -228,22 +228,13 @@ $in->exit(0); sub lilo_choice() { ask: - eval { - my $before = fs::fstab_to_string($all_hds); - any::setupBootloader($in, $bootloader, $all_hds, $fstab, $ENV{SECURE_LEVEL}); - if ($before ne fs::fstab_to_string($all_hds)) { - #- for /tmp using tmpfs when "clean /tmp" is chosen - fs::write_fstab($all_hds); - } - }; - my $err = $@; - if ($err && $err !~ /wizcancel/) { - # BUG: note that the following message won't speak about the right bootloader if user is currently switching between - # various bootloaders and if the error occured before boot sector get overwritten by bootloader installer - $in->ask_warn(N("Error"), - [ N("Installation of %s failed. The following error occured:", $bootloader->{method}), $err ]); - goto ask; + my $before = fs::fstab_to_string($all_hds); + any::setupBootloader($in, $bootloader, $all_hds, $fstab, $ENV{SECURE_LEVEL}); + if ($before ne fs::fstab_to_string($all_hds)) { + #- for /tmp using tmpfs when "clean /tmp" is chosen + fs::write_fstab($all_hds); } + any::installBootloader($in, $bootloader, $all_hds) or goto ask; } -- cgit v1.2.1