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
77
78
79
80
81
|
# Copyright (C) 2005 Mandriva
# Olivier Blin <oblin@mandriva.com>
# Copyright (C) 2017 Mageia
# Martin Whitaker <mageia@martin-whitaker.me.uk>
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA.
# SYNOPSIS
# --------
# This package defines the LiveBuild subclass that is used to hold all the
# settings and configuration values needed to build a Live ISO. It provides
# a number of helper functions over and above those provided by the ISOBuild
# superclass.
package MGA::DrakISO::LiveBuild;
use strict;
use MDK::Common;
use MGA::DrakISO::ISOBuild;
our @ISA = qw(MGA::DrakISO::ISOBuild);
sub new {
my ($class) = @_;
bless {}, $class;
}
sub default_name_fields {
my ($build) = @_;
[ qw(distro version product desktop),
if_($build->{settings}{region} ne 'all', $build->{settings}{region}),
qw(arch media)
];
}
sub get_langs {
my ($build) = @_;
uniq(
(ref $build->{regions} ? @{$build->{regions}{$build->{settings}{region}}} : ()),
@{$build->{system}{langs_always}}
);
}
sub get_live_root {
my ($build) = @_;
$build->get_build_dir('root');
}
sub find_kernel {
my ($build) = @_;
require bootloader;
local $::prefix = $build->get_live_root;
my @kernels = bootloader::get_kernels_and_labels();
my $kernel;
if ($build->{system}{kernel}) {
$kernel = find { $_->{version} eq $build->{system}{kernel} } @kernels;
$kernel or die "ERROR: kernel $build->{system}{kernel} can not be found\n";
}
$kernel ||= first(@kernels) or die "ERROR: no kernel can be found\n";
}
sub get_initrd_name {
my ($build) = @_;
'initrd-' . $build->find_kernel->{version} . '.img';
}
1;
|