diff options
Diffstat (limited to 'perl-install/standalone/drakboot')
| -rwxr-xr-x | perl-install/standalone/drakboot | 87 |
1 files changed, 36 insertions, 51 deletions
diff --git a/perl-install/standalone/drakboot b/perl-install/standalone/drakboot index b5656dc4a..b4fa43a98 100755 --- a/perl-install/standalone/drakboot +++ b/perl-install/standalone/drakboot @@ -1,65 +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 common qw(:common :file :functional); +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; +my $in = 'interactive'->vnew('su'); -/-h/ and die "usage: drakboot [--expert]\n"; - -$::expert = /-expert/; -$::isStandalone = 1; - -my $in = interactive->vnew('su'); - -my %l = ( - arch() !~ /sparc|alpha/ ? ( - _("Configure LILO/GRUB") => '', - _("Create a boot floppy") => ['/usr/X11R6/bin/drakfloppy'], - ) : (), - _("Format floppy") => [ '/usr/bin/kfloppy', '/usr/bin/gfloppy' ], -); - -while (my ($k, $v) = each %l) { - $v or next; - foreach (@$v) { - -x $_ and $l{$k} = $_, last; - } - -x $l{$k} or delete $l{$k}; -} - -if ($ENV{DISPLAY} && c::Xtest($ENV{DISPLAY})) { - my $cmd = $l{$in->ask_from_list(_("Choice"), _("What do you want to do?"), [ keys %l ])}; - exec $cmd if $cmd; -} - -my $bootloader = bootloader::read('', '/etc/lilo.conf'); -local ($_) = `detectloader`; -$bootloader->{methods} = { lilo => 1, grub => !!/grub/i }; - -my $hds = catch_cdie { fsedit::hds([ detect_devices::hds() ], {}) } sub { 1 }; -my $fstab = [ fsedit::get_fstab(@$hds) ]; -fs::get_mntpoints_from_fstab($fstab); - -ask: -any::setupBootloader($in, $bootloader, $hds, $fstab, $ENV{SECURE_LEVEL}) or $in->exit(0); - -eval { bootloader::install('', $bootloader, $fstab, $hds) }; - -if ($@) { - $in->ask_warn('', - [ _("Installation of LILO failed. The following error occured:"), - grep { !/^Warning:/ } cat_("/tmp/.error") ]); - unlink "/tmp/.error"; - goto ask; +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); } +$::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); |
