blob: 8f54e6278dd38b8e36d74b778021b33bb6116071 (
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
70
71
72
73
74
75
76
|
package MGA::DrakISO::Live;
use strict;
use MDK::Common;
sub new {
my ($class) = @_;
bless {}, $class;
}
sub default_name_fields {
my ($live) = @_;
[ qw(name version product desktop),
if_($live->{settings}{region} ne 'all', $live->{settings}{region}),
qw(arch media)
];
}
sub get_name {
my ($live) = @_;
my $fields = $live->{name_fields} || default_name_fields($live);
join('-', grep { $_ } @{$live->{settings}}{@$fields});
}
sub get_set_suffix {
my ($live) = @_;
$live->{settings}{set} ? "-$live->{settings}{set}" : "";
}
sub get_langs {
my ($live) = @_;
uniq(
(ref $live->{regions} ? @{$live->{regions}{$live->{settings}{region}}} : ()),
@{$live->{system}{langs_always}}
);
}
sub get_builddir {
my ($live, $o_subdir) = @_;
$live->{settings}{builddir} . '/' . $live->get_name . $live->get_set_suffix . if_($o_subdir, '/' . $o_subdir);
}
sub get_system_root {
my ($live) = @_;
$live->{settings}{chroot} . '/' . $live->get_name . $live->get_set_suffix;
}
sub find_kernel {
my ($live) = @_;
require bootloader;
local $::prefix = $live->get_system_root;
my @kernels = bootloader::get_kernels_and_labels();
my $kernel;
if ($live->{system}{kernel}) {
$kernel = find { $_->{version} eq $live->{system}{kernel} } @kernels;
$kernel or die "kernel $live->{system}{kernel} can not be found\n";
}
$kernel ||= first(@kernels) or die "no kernel can be found\n";
}
sub get_initrd_name {
my ($live) = @_;
'initrd-' . $live->find_kernel->{version} . '.img';
}
sub get_absolute_path {
my ($live, $path) = @_;
if (defined $path && substr($path, 0, 1) ne '/') {
$live->{settings}{config_root} . '/' . $path;
} else {
$path;
}
}
1;
|