summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/drakboot
blob: f2ed2b921e787f3c2c419d0de4d41b784eba4a1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/perl

use lib qw(/usr/lib/libDrakX);
use MDK::Common;

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');

$::lilo_choice = \&lilo_choice;

if ($in->isa('interactive::gtk')) {
    require 'bootlook.pm';
} else {
    lilo_choice();
}

!$::isEmbedded and $in->exit(0);
kill('USR1', $::CCPID);
goto ask;

sub lilo_choice
{
    my $bootloader = bootloader::read(); 
    local ($_) = `detectloader`;
    $bootloader->{methods} = {
        if_(arch() =~ /ppc/, yaboot => 1),
        if_(arch() =~ /sparc/, silo => 1),
        if_(arch() =~ /ia64/, elilo => 1),
        if_(arch() =~ /i.86|x86_64/, lilo => 1),
        if_(arch() =~ /i.86/, grub => !!/grub/i)
    };
    
    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;
    }
}