#!/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 common; use interactive; use any; use bootloader; use fsedit; use fs; my $in = 'interactive'->vnew('su'); my $all_hds; my $fstab; my $bootloader; my $cmdline = cat_('/proc/cmdline'); my $is_bootloader_mode = !$in->isa('interactive::gtk') || any { /^--boot$/ } @ARGV; if ($is_bootloader_mode) { $all_hds = fsedit::get_hds(); fs::get_raw_hds('', $all_hds); fs::get_info_from_fstab($all_hds); $fstab = [ fs::get::fstab($all_hds) ]; $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); } } if ($is_bootloader_mode) { $::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); }