diff options
Diffstat (limited to 'perl-install/standalone/drakboot')
-rwxr-xr-x | perl-install/standalone/drakboot | 84 |
1 files changed, 36 insertions, 48 deletions
diff --git a/perl-install/standalone/drakboot b/perl-install/standalone/drakboot index ade6207de..b4fa43a98 100755 --- a/perl-install/standalone/drakboot +++ b/perl-install/standalone/drakboot @@ -1,62 +1,50 @@ #!/usr/bin/perl +# DrakBoot +# Copyright (C) 2001-2008 Mandriva +# Yves Duret, Thierry Vignaud +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +use strict; +use diagnostics; use lib qw(/usr/lib/libDrakX); -use standalone; #- warning, standalone must be loaded very first, for 'explanations' - +use standalone; #- warning, standalone must be loaded very first, for 'explanations' use common; use interactive; use any; use bootloader; -use detect_devices; use fsedit; use fs; -use c; - -local $_ = join '', @ARGV; - -/-h/ and die "usage: drakboot [--expert] [--testing]\n"; - -$::expert = /-expert/; -$::testing = /-testing/; -my $in = 'interactive'->vnew('su', 'bootloader'); +my $in = 'interactive'->vnew('su'); -$::lilo_choice = \&lilo_choice; - -if ($in->isa('interactive::gtk')) { - require 'bootlook.pm'; -} else { - lilo_choice(); +my $all_hds = fsedit::get_hds(); +fs::get_raw_hds('', $all_hds); +fs::get_info_from_fstab($all_hds); +my $fstab = [ fs::get::fstab($all_hds) ]; +my $bootloader = bootloader::read($all_hds); +if (!$bootloader) { + $in->ask_okcancel('', N("No bootloader found, creating a new configuration"), 0) or $in->exit; + any::setupBootloaderBeforeStandalone($in->do_pkgs, $bootloader ||= {}, $all_hds, $fstab); } -!$::isEmbedded and $in->exit(0); -kill('USR1', $::CCPID); -goto ask; - -sub lilo_choice -{ - my $bootloader = bootloader::read(); - local ($_) = `detectloader`; - $bootloader->{methods} = { lilo => 1, grub => !!/grub/i, if_(arch() =~ /ppc/, yaboot => 1) }; - - my ($all_hds) = fsedit::get_hds(); - my $fstab = [ fsedit::get_all_fstab($all_hds) ]; - fs::merge_info_from_fstab($fstab); - - $::expert=1; - - ask: - local $::isEmbedded = 0; - any::setupBootloader($in, $bootloader, $all_hds, $fstab, $ENV{SECURE_LEVEL}) or return; - eval { bootloader::install($bootloader, $fstab, $all_hds->{hds}) }; - - my $loader = arch() =~ /ppc/ ? "Yaboot" : "LILO"; - if ($@) { - $in->ask_warn('', - [ _("Installation of %s failed. The following error occured:", $loader), - grep { !/^Warning:/ } cat_("/tmp/.error") ]); - unlink "/tmp/.error"; - goto ask; - } -} +$::isWizard = 1; +require security::level; +my $level = security::level::from_string(security::level::get()); +eval { any::setupBootloaderUntilInstalled($in, $bootloader, $all_hds, $fstab, $level) }; +die if $@ && $@ !~ /^wizcancel/; +$in->exit(0); |