summaryrefslogtreecommitdiffstats
path: root/lib/MGA/DrakISO/BuildISO.pm
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2017-12-22 00:27:49 +0000
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2017-12-22 00:28:31 +0000
commitfcdc9d5967cbf861db391a777bb129afc2e2560b (patch)
tree68e13a27e47122ec4dcce465fe64323f745a8ea2 /lib/MGA/DrakISO/BuildISO.pm
parentb52888b09904b607c8351da18affaf19e3690ee9 (diff)
downloaddrakiso-fcdc9d5967cbf861db391a777bb129afc2e2560b.tar
drakiso-fcdc9d5967cbf861db391a777bb129afc2e2560b.tar.gz
drakiso-fcdc9d5967cbf861db391a777bb129afc2e2560b.tar.bz2
drakiso-fcdc9d5967cbf861db391a777bb129afc2e2560b.tar.xz
drakiso-fcdc9d5967cbf861db391a777bb129afc2e2560b.zip
Numerous changes to support building classic installer ISOs:
- rename {media}{source} to {media}{label} and require the user to supply it o automatically add the LABEL= prefix, rather than removing it - rename {settings}{name} to {settings}{distro} - move get_system_root() to ISOBuild - CI builds use it as the urpmi-root - add new requirements in Config::check_config() - rename build_live_iso() to build_iso() and support CI builds o make output to file non-optional - we always want a file o add the DATE.txt file to the ISO image - modify prepare_iso_bootloader to support CI boot menus
Diffstat (limited to 'lib/MGA/DrakISO/BuildISO.pm')
-rwxr-xr-xlib/MGA/DrakISO/BuildISO.pm70
1 files changed, 41 insertions, 29 deletions
diff --git a/lib/MGA/DrakISO/BuildISO.pm b/lib/MGA/DrakISO/BuildISO.pm
index eb28c6c..a3b7851 100755
--- a/lib/MGA/DrakISO/BuildISO.pm
+++ b/lib/MGA/DrakISO/BuildISO.pm
@@ -17,6 +17,12 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# SYNOPSIS
+# --------
+# This module provides a function to build the ISO image. All the files
+# to go on the ISO should be stored in or linked into the build directory
+# before performing this step.
+
package MGA::DrakISO::BuildISO;
use strict;
@@ -24,7 +30,7 @@ use strict;
use MDK::Common;
use common;
-use MGA::DrakISO::LiveBuild;
+use MGA::DrakISO::ISOBuild;
use MGA::DrakISO::Loopback;
use MGA::DrakISO::Utils;
@@ -32,16 +38,17 @@ use MGA::DrakISO::BuildLoop;
use Exporter;
our @ISA = qw(Exporter);
-our @EXPORT = qw(build_live_iso);
-
-###############################################################################
-# Live System
-###############################################################################
+our @EXPORT = qw(build_iso);
-sub build_live_iso {
+sub build_iso {
my ($build) = @_;
- my $label = $build->{media}->get_media_label or die "the source device must be described by a label\n";
+ my $arch = $build->{settings}{arch};
+ my $label = $build->{media}{label};
+
+ my $arch_dir = $build->get_builddir($arch);
+ my $dosutils = $build->get_builddir('dosutils');
+ my $loopbacks = $build->get_builddir('loopbacks');
my $mbr_image = $build->get_absolute_path($build->{media}{mbr_boot_img}) // '/usr/lib/grub/i386-pc/boot_hybrid.img';
-e $mbr_image or die "cannot find MBR boot image $mbr_image\n";
@@ -62,9 +69,15 @@ sub build_live_iso {
if_($build->{settings}{arch} eq 'x86_64',
'/EFI=' . $build->get_builddir('EFI'),
),
- (
+ if_(-d $dosutils,
+ "dosutils=" . $dosutils,
+ ),
+ if_(-d $arch_dir,
+ "$arch=" . $arch_dir,
+ ),
+ if_(-d $loopbacks,
map {
- '/loopbacks' . $_ . '=' . $build->get_builddir('loopbacks') . $_;
+ '/loopbacks' . $_ . '=' . $loopbacks . $_;
} list_selected_loopbacks($build)
),
if_($build->{media}{files},
@@ -83,10 +96,6 @@ sub list_selected_loopbacks {
(map { '/modules/' . $_->{name} . $loop_types{$_->{type}}{extension} } @pack_modules);
}
-###############################################################################
-# Generic
-###############################################################################
-
# This builds a hybrid ISO capable of both legacy and UEFI boot. The
# ISO contains a primary iso9660 partition (which is the only thing
# visible when booting from DVD) and a secondary ESP partition (which
@@ -109,9 +118,15 @@ sub list_selected_loopbacks {
sub build_iso_image {
my ($build, $dest, $label, $mbr_image, $esp_image, @opts) = @_;
+ my $dir = dirname($dest);
+
+ my $date_file = $dir . '/DATE.txt';
+ run_('date', '>', $date_file);
+
run_('xorrisofs',
'-pad', '-l', '-R', '-J',
'-V', $label,
+ '-follow-links',
'-graft-points',
'-hide-rr-moved',
'--sort-weight', 0, '/',
@@ -133,24 +148,21 @@ sub build_iso_image {
'-iso_mbr_part_type', '0x00',
'-append_partition', 2, '0xef', $esp_image,
),
- if_($dest, '-o', $dest),
+ '-o', $dest,
@opts,
+ '/DATE.txt=' . $date_file,
) or die "unable to run xorrisofs\n";
- if ($dest) {
- my $dir = dirname($dest);
- my $filename = basename($dest);
- run_('mgaiso-addmd5', '>', '/dev/null', '2>', '/dev/null', $dest);
- run_({ chdir => $dir }, 'md5sum', '>', $dest . '.md5', $filename);
- run_({ chdir => $dir }, 'sha1sum', '>', $dest . '.sha1', $filename);
- run_({ chdir => $dir }, 'sha512sum', '>', $dest . '.sha512', $filename);
- run_({ chdir => $dir }, 'date', '>', $dir . '/DATE.txt');
- if (my $suffix = $build->get_set_suffix) {
- if (my ($prefix, $ext) = $dest =~ /(.*)(\.[^.]+)$/) {
- my $link = $prefix . $suffix . $ext;
- linkf($dest, $link);
- print "linked as $link\n";
- }
+ my $filename = basename($dest);
+ run_('mgaiso-addmd5', '>', '/dev/null', '2>', '/dev/null', $dest);
+ run_({ chdir => $dir }, 'md5sum', '>', $dest . '.md5', $filename);
+ run_({ chdir => $dir }, 'sha1sum', '>', $dest . '.sha1', $filename);
+ run_({ chdir => $dir }, 'sha512sum', '>', $dest . '.sha512', $filename);
+ if (my $suffix = $build->get_set_suffix) {
+ if (my ($prefix, $ext) = $dest =~ /(.*)(\.[^.]+)$/) {
+ my $link = $prefix . $suffix . $ext;
+ linkf($dest, $link);
+ print "linked as $link\n";
}
}
}