diff options
author | Martin Whitaker <mageia@martin-whitaker.me.uk> | 2017-12-22 15:36:18 +0000 |
---|---|---|
committer | Martin Whitaker <mageia@martin-whitaker.me.uk> | 2017-12-22 16:16:00 +0000 |
commit | 8152efd28ce168ddedf8031c07b8bd7418c9526e (patch) | |
tree | 203db6846e7a68386085568c1f67343b93d7d0f0 /lib | |
parent | 04ffb8d90e011c17c386c7be71eb0eb51e597e52 (diff) | |
download | drakiso-8152efd28ce168ddedf8031c07b8bd7418c9526e.tar drakiso-8152efd28ce168ddedf8031c07b8bd7418c9526e.tar.gz drakiso-8152efd28ce168ddedf8031c07b8bd7418c9526e.tar.bz2 drakiso-8152efd28ce168ddedf8031c07b8bd7418c9526e.tar.xz drakiso-8152efd28ce168ddedf8031c07b8bd7418c9526e.zip |
Tidy up BuildIso and supply extra volume metadata to xorriso.
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/MGA/DrakISO/BuildISO.pm | 79 |
1 files changed, 42 insertions, 37 deletions
diff --git a/lib/MGA/DrakISO/BuildISO.pm b/lib/MGA/DrakISO/BuildISO.pm index a3b7851..3bded42 100755 --- a/lib/MGA/DrakISO/BuildISO.pm +++ b/lib/MGA/DrakISO/BuildISO.pm @@ -40,31 +40,21 @@ use Exporter; our @ISA = qw(Exporter); our @EXPORT = qw(build_iso); +# This is the top-level function called to build an iso image. It generates +# the list of file assignments before calling build_iso_image() to do the +# actual work. +# sub build_iso { my ($build) = @_; 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"; - - my $esp_image = $build->get_builddir('images') . '/esp.img'; - -e $esp_image or die "cannot find ESP image $esp_image\n"; - - my $dest = $build->get_builddir('dist') . '/' . $build->get_name . '.iso'; - mkdir_p(dirname($dest)); - build_iso_image( $build, - $dest, - $label, - $mbr_image, - $esp_image, '/boot=' . $build->get_builddir('boot'), if_($build->{settings}{arch} eq 'x86_64', '/EFI=' . $build->get_builddir('EFI'), @@ -96,36 +86,51 @@ sub list_selected_loopbacks { (map { '/modules/' . $_->{name} . $loop_types{$_->{type}}{extension} } @pack_modules); } -# 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 -# is only used for USB UEFI boot). +# This function 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 is only used +# for USB UEFI boot). # -# For legacy boot, the system boots the grub2 El Torito image. For DVD -# boot, this is located via the El Torito catalogue. For USB boot, it -# is located via the grub2 MBR hybrid boot image, which is stored in -# the MBR. In both cases the initial grub2 root location is the iso9660 -# partition, so the initial grub2 configuration file will be read from -# that partition. +# For legacy boot, the system boots the grub2 El Torito image. For DVD boot, +# this is located via the El Torito catalogue. For USB boot, it is located +# via the grub2 MBR hybrid boot image, which is stored in the MBR. In both +# cases the initial grub2 root location is the iso9660 partition, so the +# initial grub2 configuration file will be read from that partition. # -# For UEFI boot, the system boots the grub2 EFI image. For DVD boot, -# this is located via the El Torito catalogue, and we store it in the -# iso9660 partition. For USB boot, it must be located in the /EFI/BOOT -# directory in the ESP. For DVD boot the initial grub2 root location is -# the iso9660 partition, for USB boot it is the ESP partition, and the -# initial grub2 configuration file will be located accordingly. +# For UEFI boot, the system boots the grub2 EFI image. For DVD boot, this +# is located via the El Torito catalogue, and we store it in the iso9660 +# partition. For USB boot, it must be located in the /EFI/BOOT directory +# in the ESP. For DVD boot the initial grub2 root location is the iso9660 +# partition, for USB boot it is the ESP partition, and the initial grub2 +# configuration file will be located accordingly. # sub build_iso_image { - my ($build, $dest, $label, $mbr_image, $esp_image, @opts) = @_; + my ($build, @opts) = @_; + + 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"; + + my $esp_image = $build->get_builddir('images') . '/esp.img'; + -e $esp_image or die "cannot find ESP image $esp_image\n"; + + my $build_dir = $build->get_builddir('dist'); + mkdir_p($build_dir); + + my $dest = $build_dir . '/' . $build->get_name . '.iso'; - my $dir = dirname($dest); + my $xorriso_version = `xorriso -version 2> /dev/null | head -1`; + chomp($xorriso_version); - my $date_file = $dir . '/DATE.txt'; + my $date_file = $build_dir . '/DATE.txt'; run_('date', '>', $date_file); run_('xorrisofs', '-pad', '-l', '-R', '-J', - '-V', $label, + '-publisher', $build->{settings}{vendor}, + '-preparer', 'drakiso', + '-sysid', 'Linux', + '-appid', $xorriso_version, + '-volid', $build->{media}{label}, '-follow-links', '-graft-points', '-hide-rr-moved', @@ -155,9 +160,9 @@ sub build_iso_image { 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 => $build_dir }, 'md5sum', '>', $dest . '.md5', $filename); + run_({ chdir => $build_dir }, 'sha1sum', '>', $dest . '.sha1', $filename); + run_({ chdir => $build_dir }, 'sha512sum', '>', $dest . '.sha512', $filename); if (my $suffix = $build->get_set_suffix) { if (my ($prefix, $ext) = $dest =~ /(.*)(\.[^.]+)$/) { my $link = $prefix . $suffix . $ext; |