# Copyright (C) 2005 Mandriva # Olivier Blin # Copyright (C) 2017-2018 Mageia # Martin Whitaker # # 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 release 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;