summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/drakboot
blob: 8a17b481328d892af08ad9b3f76ff7c655ea1199 (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
#!/usr/bin/perl

use lib qw(/usr/lib/libDrakX);


use common;
use interactive;
use standalone;
use any;
use bootloader;
use detect_devices;
use fsedit;
use fs;
use c;

$::isEmbedded = ($::XID, $::CCPID) = "@ARGV" =~ /--embedded (\w+) (\w+)/;
local $_ = join '', @ARGV;

/-h/ and die "usage: drakboot [--expert]\n";

$::expert = /-expert/;

my $in = 'interactive'->vnew('su', 'bootloader');

require 'bootlook.pm' if $in->isa('interactive_gtk');
lilo_choice();


sub lilo_choice
{
    my $bootloader = bootloader::read('', '/etc/lilo.conf');
    local ($_) = `detectloader`;
    $bootloader->{methods} = { lilo => 1, grub => !!/grub/i };
    
    my ($all_hds) = catch_cdie { fsedit::hds([ detect_devices::hds() ], {}) } sub { 1 };
    my $fstab = [ fsedit::get_all_fstab(@$all_hds) ];
    fs::merge_info_from_fstab($fstab);
    
    $::expert=1;
    
  ask:
    any::setupBootloader($in, $bootloader, $all_hds, $fstab, $ENV{SECURE_LEVEL}) or $in->exit(0);
    eval { bootloader::install('', $bootloader, $fstab, $all_hds->{hds}) };

    if ($@) {
	$in->ask_warn('', 
		      [ _("Installation of LILO failed. The following error occured:"),
			grep { !/^Warning:/ } cat_("/tmp/.error") ]);
	unlink "/tmp/.error";
	goto ask;
    }
}
    !$::isEmbedded and $in->exit(0);
    kill(USR1, $::CCPID);
    goto ask;