summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2017-11-29 14:24:40 +0000
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2017-11-29 14:24:40 +0000
commitbb3602d4081e5d6d56ea3629f808cc2ed5f56f94 (patch)
treead987dbdc684f7ec4f4ec681edab52f8c4a73dff
parent83fef3336a24cf93b9fd0d85de9fbea6dc3f5710 (diff)
downloaddrakiso-bb3602d4081e5d6d56ea3629f808cc2ed5f56f94.tar
drakiso-bb3602d4081e5d6d56ea3629f808cc2ed5f56f94.tar.gz
drakiso-bb3602d4081e5d6d56ea3629f808cc2ed5f56f94.tar.bz2
drakiso-bb3602d4081e5d6d56ea3629f808cc2ed5f56f94.tar.xz
drakiso-bb3602d4081e5d6d56ea3629f808cc2ed5f56f94.zip
draklive2: major rework to use grub2 as the bootloader.
Drop some unwanted stuff in the process: - the --boot-only option (not really very useful) - the progress indicator in build_iso_image() (xorriso reports progress itself)
-rwxr-xr-xdraklive2545
-rw-r--r--lib/MDV/Draklive/Config.pm5
-rw-r--r--lib/MDV/Draklive/Storage.pm1
3 files changed, 210 insertions, 341 deletions
diff --git a/draklive2 b/draklive2
index 7512ac4..fe6a471 100755
--- a/draklive2
+++ b/draklive2
@@ -33,116 +33,10 @@ use IO::Handle; #- autoflush
use POSIX;
use MDV::Draklive::Utils;
use MDV::Draklive::Live;
-use MDV::Draklive::Progress;
use MDV::Draklive::Loopback;
use MDV::Draklive::Config;
use MDV::Draklive::Storage;
-sub get_syslinux_path {
- my ($media, $opts) = @_;
- '/' . $media->{storage} . '/syslinux' . ($opts->{boot} && '-boot-' . $opts->{boot}) . '.cfg';
-}
-
-sub need_media_specific_boot {
- my ($live) = @_;
- to_bool(list_selected_loopbacks($live));
-}
-
-sub get_default_append {
- my ($live, $opts) = @_;
- my $append = $opts->{append} || $live->{system}{append};
- join(' ',
- 'root=mgalive:' . $live->{media}->get_media_source_for_nash,
- if_($live->{system}{vga_mode} && $append !~ /\bvga=\b/,
- 'splash quiet noiswmd audit=0 rd.luks=0 rd.lvm=0 rd.md=0 rd.dm=0',
- 'vga=' . $live->{system}{vga_mode}),
- if_($append, $append),
- );
-}
-
-sub get_bootloader_timeout {
- my ($live) = @_;
- defined $live->{media}{bootloader_timeout} ? $live->{media}{bootloader_timeout} : 4;
-}
-
-my @syslinux_boot_files = qw(/vmlinuz /syslinux/bootlogo /help.msg);
-
-sub build_syslinux_cfg {
- my ($live, $media, $opts) = @_;
- my $append = get_default_append($live, $opts);
- #- syslinux wants files at root (used with vfat fs)
- my $to_root = $media->get_boot_setting('fs', $opts) eq 'vfat';
- my $boot = $live->get_media_prefix('boot', $opts->{boot});
- my ($initrd, $kernel, $bootlogo, $help) = map { $to_root ? basename($_) : $_ }
- map { $boot . $_ } $media->get_initrd_path, @syslinux_boot_files;
- #- the generated syslinux/bootlogo is incomplete, so replace it
- my $bootdir = $live->get_builddir . $live->{prefix}{build}{boot};
- my $has_bootlogo = $live->{system}{gfxboot} && -e ($bootdir . '/gfxmenu');
- cp_f($bootdir . '/gfxmenu', $bootdir . '/syslinux/bootlogo') if $has_bootlogo;
- my $timeout = get_bootloader_timeout($live) * 10;
- my $title = $media->{title} || $live->{media}{title};
- join("\n",
- "default $title",
- "prompt 1",
- "timeout $timeout",
- "display $help",
- if_($has_bootlogo, "ui gfxboot.c32 $bootlogo"),
- (map {
- my ($name, $cmdline) = @$_;
- $name =~ s/\s/_/g;
- if ($name eq "harddisk") {
- "label " . $name,
- " com32 chain.c32 hd0 exit";
- } else {
- "label " . ($name || $title),
- " kernel $kernel",
- " append initrd=$initrd $append $cmdline";
- }
- } group_by2(@{$media->{boot_entries}})),
- "",
- );
-}
-
-sub build_grub_cfg {
- my ($live, $media, $opts, $device) = @_;
- #- FIXME? first partition is hardcoded for loopback (master images)
- #- FIXME? use find_partition_index
- my ($part_nb) = $device =~ m!/dev/loop! ? 1 : $device =~ /(\d+)$/;
- my $part_idx = $part_nb - 1;
- my $initrd = $media->get_initrd_path;
- build_grub_cfg_raw($live, $media, $initrd, $opts, $part_idx);
-}
-
-sub build_grub_cfg_raw {
- my ($live, $media, $initrd, $opts, $part_idx) = @_;
- #- FIXME: use the bootloader module from drakx
- my $grub_part = "(hd0" . (defined $part_idx ? "," . $part_idx : "") . ")";
- my $boot = $live->get_media_prefix('boot'); #- FIXME handle boot media
- #- remove prefix if installing bootloader on separate /boot partition
- $media->{partitions}[$part_idx]{mntpoint} eq $boot and $boot = "";
-
- my $title = $media->{title} || $live->{media}{title};
-
- join("\n",
- "timeout " . get_bootloader_timeout($live),
- if_($live->{system}{gfxboot}, "gfxmenu $grub_part" . $boot . "/gfxmenu"),
- "default 0",
- (map {
- my ($name, $cmdline) = @$_;
- "title " . $title . if_($name, " ($name)"),
- "kernel $grub_part" . $boot . "/vmlinuz " . get_default_append($live, $opts) . if_($cmdline, " $cmdline"),
- if_($initrd, "initrd " . $boot . $initrd);
- } group_by2(@{$media->{boot_entries}})),
- ($live->{oem_rescue} && defined $opts->{oem_rescue_idx} ? (
- #- FIXME: factorize with above, build_grub_cfg_entry($media)
- "title " . $live->{oem_rescue}{media}{title},
- "kernel (hd0,$opts->{oem_rescue_idx})" . $boot . "/vmlinuz " . $live->{oem_rescue}{append},
- "initrd (hd0,$opts->{oem_rescue_idx})" . $boot . $media->get_initrd_path,
- ) : ()),
- "",
- );
-}
-
sub get_langs {
my ($live) = @_;
uniq(
@@ -482,287 +376,283 @@ sub list_selected_loopbacks {
(map { $live->{prefix}{build}{modules} . '/' . $_->{name} . $loop_types{$_->{type}}{extension} } @pack_modules);
}
-sub get_media_device {
- my ($live, $opts) = @_;
- return $opts->{device} if $opts->{device};
- my $label = $live->{media}->get_media_label
- or die "no device and no label";
- my $device = chomp_(`readlink -f /dev/disk/by-label/$label`)
- or die "unable to find device for /dev/disk/by-label/$label\n";
- $device;
-}
-
sub prepare_bootloader {
my ($live) = @_;
create_initrd($live);
- create_bootloader($live) if !($live->{system}{skip_bootloader_config} || $live->{system}{skip_bootloader_install});
+ create_bootloader($live);
}
sub create_initrd {
my ($live) = @_;
my $root = $live->get_system_root;
- mount_system_fs($live);
-
my $kernel = $live->find_kernel;
print "using kernel $kernel->{version}\n";
- my $initrd_file = $root . '/boot/' . $live->get_initrd_name;
- unlink($initrd_file);
+ my $initrd = $root . '/boot/' . $live->get_initrd_name;
+ unlink($initrd);
+ mount_system_fs($live);
{
my $bootloader = {};
local $::prefix = $root;
bootloader::add_kernel($bootloader, $kernel, { label => 'linux', vga => $live->{system}{vga_mode} }, '', $live->{system}{no_initrd});
}
-
umount_system_fs($live);
- if (need_media_specific_boot($live)) {
- my $rootfs_initrd = $root . '/boot/' . $live->get_initrd_name;
- my $media_initrd = $live->get_builddir . $live->{prefix}{build}{boot} . $live->{media}->get_initrd_path;
- mkdir_p(dirname($media_initrd));
- mv($rootfs_initrd, $media_initrd) or die "can not move initrd: $!";
- }
+ my $boot_dir = $live->get_builddir . $live->{prefix}{build}{boot};
+ mkdir_p($boot_dir);
+ mv($initrd, $boot_dir . '/initrd.gz') or die "cannot move initrd: $!\n";
}
sub create_bootloader {
my ($live) = @_;
+ my $boot_dir = $live->get_builddir . $live->{prefix}{build}{boot};
+ mkdir_p($boot_dir);
+
my $root = $live->get_system_root;
+
my $kernel = $live->find_kernel->{version};
- my $vmlinuz_long = '/boot/vmlinuz-' . $kernel;
- -e $root . $vmlinuz_long or die "can not find kernel $kernel\n";
-
- if ($live->{system}{gfxboot}) {
- mount_system_fs($live);
-
- #- would be run by bootloader::add_boot_splash and make-boot-splash, but not called when we don't generate an initrd
- run_({ root => $root }, '/usr/share/bootsplash/scripts/switch-themes', '-u');
- #- grub-gfxmenu would be run by bootloader::write_grub from DrakX
- run_({ root => $root }, '/usr/sbin/grub-gfxmenu', '--update-gfxmenu');
- my $gfxmenu = $root . '/boot/gfxmenu';
- if (-e $gfxmenu) {
- my $boot_dir = $live->get_builddir . $live->{prefix}{build}{boot};
- mkdir_p($boot_dir);
- cp_f($gfxmenu, $boot_dir);
- } else {
- warn "no gfxmenu file\n";
- }
+ my $vmlinuz = $root . '/boot/vmlinuz-' . $kernel;
+ -e $vmlinuz or die "cannot find kernel $kernel\n";
+ cp_f($vmlinuz, $boot_dir . '/vmlinuz');
- umount_system_fs($live);
+ my $grub2_dir = $boot_dir . '/grub2';
+ mkdir_p($grub2_dir);
+
+ my $fonts_dir = $grub2_dir . '/fonts';
+ mkdir_p($fonts_dir);
+
+ my $font = $root . '/usr/share/grub/unicode.pf2';
+ cp_f($font, $fonts_dir) if -e $font;
+
+ my $themes_dir = $grub2_dir . '/themes';
+ mkdir_p($themes_dir);
+
+ my $theme_name = $live->{media}{bootloader_theme};
+ my @theme_fonts;
+ if (defined $theme_name) {
+ my $theme = $root . '/boot/grub2/themes/' . $theme_name;
+ -e $theme or die "cannot find grub2 $theme_name theme\n";
+ cp_f($theme, $themes_dir);
+ @theme_fonts = map { basename($_) } glob("$theme/*.pf2");
}
- # this will copy (among other things) the gfxboot theme to the media
- # so this must be done before the creating the bootloader since the code
- # in there may check if a bootlogo is present or not
- create_syslinux_msg_files($live);
+ my $eltorito_img = $live->{settings}{config_root} . '/' . $live->{media}{eltorito_img};
+ -e $eltorito_img or die "cannot find grub2 eltorito.img $eltorito_img\n";
+ cp_f($eltorito_img, $grub2_dir . '/eltorito.img');
+
+ my $label = $live->{media}->get_media_label;
- if (need_media_specific_boot($live)) {
- create_media_bootloader($live);
+ my $grub2_cfg = $grub2_dir . '/grub.cfg';
+ if ($live->{media}{grub2_cfg}) {
+ cp_f($live->{settings}{config_root} . '/' . $live->{media}{grub2_cfg}, $grub2_cfg);
+ run_("sed", "-i", "s/VOLUME_LABEL/$label/g", $grub2_cfg);
} else {
- create_classical_bootloader($live);
+ output($grub2_cfg, build_grub2_cfg($live, $theme_name, \@theme_fonts));
}
- create_efi_boot_image($live) if $live->{settings}{arch} eq 'x86_64';
-}
+ my $title = $label;
+ $title =~ s/-/ /gr;
-sub remove_unneeded_bootlogo_locales {
- use File::Temp;
- use Cwd;
-
- my ($bootlogo, @locales) = @_;
-
- $bootlogo = Cwd::realpath($bootlogo);
- -f $bootlogo or return;
-
- my $cwd = Cwd::getcwd();
- my $tempdir = File::Temp::tempdir("mgagfxbootXXXX", CLEANUP => 1);
- chdir $tempdir;
- !system("cpio -id < $bootlogo") or return;
-
- # Make sure we include the en locale
- push @locales, 'en';
- my @kept_locales;
- foreach my $file (glob "*.tr") {
- if (!any { $file =~ /^$_\.tr$/ } @locales) {
- unlink $file;
- } else {
- my ($locale_name) = $file =~ /(.*)\.tr$/;
- push @kept_locales, $locale_name;
- }
+ my $base_theme_txt = $grub2_dir . "/themes/$theme_name/theme.txt";
+ if (defined $theme_name && -e $base_theme_txt) {
+ run_('sed', '-i', qq(s/title-text:.*/title-text: "$title"/), $base_theme_txt);
}
- system(qq(echo init 16x16.fnt *.tr |sed "s/ /\\n/g" |cpio -o >$bootlogo));
- chdir $cwd;
- print "gfxboot locales: " . join(" ", @kept_locales) . "\n";
- return @kept_locales;
-}
+ return if $live->{settings}{arch} ne 'x86_64';
+
+ my $bootx64_efi = $live->{settings}{config_root} . '/' . $live->{media}{bootx64_efi};
+ -e $bootx64_efi or die "cannot find grub2 bootx64.efi $bootx64_efi\n";
+
+ my $efi_root_dir = $live->get_builddir . $live->{prefix}{build}{EFI};
+ my $efi_boot_dir = $efi_root_dir . '/BOOT';
+ mkdir_p($efi_boot_dir);
+
+ cp_f($bootx64_efi, $efi_boot_dir);
-#- forked from bootsplash::themes_read_sysconfig
-sub get_bootsplash_theme() {
- my $sysconfig_file = "/etc/sysconfig/bootsplash";
- local $_;
- my %theme;
- foreach (cat_($::prefix . $sysconfig_file)) {
- /^THEME=(.*)/ and $theme{name} = $1;
+ output($efi_boot_dir . '/grub.cfg', build_uefi_grub2_cfg($live));
+
+ if (defined $theme_name && -e $base_theme_txt) {
+ my $uefi_theme_txt = $grub2_dir . "/themes/$theme_name/theme-uefi.txt";
+ cp_f($base_theme_txt, $uefi_theme_txt);
+ run_('sed', '-i', qq(s/title-text:.*/title-text: "$title (UEFI)"/), $uefi_theme_txt);
}
- \%theme;
+
+ my $images_dir = $live->get_builddir . $live->{prefix}{build}{images};
+ mkdir_p($images_dir);
+
+ my $esp_image = $images_dir . '/esp.img';
+ eval { rm_rf($esp_image) };
+ run_("/sbin/mkdosfs", "-F12", "-C", $esp_image, "4096");
+ run_("mcopy", "-s", "-i", $esp_image, $efi_root_dir, "::");
}
-sub create_syslinux_msg_files {
- my ($live) = @_;
- my $syslinux_dir = $live->get_builddir . $live->{prefix}{build}{boot} . '/syslinux';
- mkdir_p($syslinux_dir);
-
- if ($live->{system}{gfxboot}) {
- my $product = common::parse_LDAP_namespace_structure(cat_($live->get_system_root . '/etc/product.id'));
- my $default_gfxboot_theme = $product->{distribution};
- my $theme = do {
- local $::prefix = $live->get_system_root;
- get_bootsplash_theme();
- };
- print "copying $default_gfxboot_theme gfxboot theme\n";
- cp_f(glob_($live->get_system_root . "/usr/share/gfxboot/themes/$default_gfxboot_theme/install/*"), $syslinux_dir);
- if ($theme->{name} ne $default_gfxboot_theme) {
- print "copying $theme->{name} gfxboot theme\n";
- cp_f(glob_($live->get_system_root . "/usr/share/gfxboot/themes/$theme->{name}/*"), $syslinux_dir);
- }
- my $bootlogo = $syslinux_dir . '/bootlogo';
- warn "unable to find gfxboot splash ($bootlogo)\n" if ! -f $bootlogo;
- my @locales = remove_unneeded_bootlogo_locales($bootlogo, get_langs($live));
- output_p($syslinux_dir . '/langs', join("\n", @locales) . "\n");
- output_p($syslinux_dir . '/gfxboot.cfg', join("\n",
- "livecd=1",
- "mainmenu.pos=210,235",
- "mainmenu.bar.minwidth=400",
- "panel.f-key.fg=0x33358c",
- "",
- ));
- }
+sub build_grub2_cfg {
+ my ($live, $theme_name, $theme_fonts) = @_;
- output($live->get_builddir . $live->{prefix}{build}{boot} . '/help.msg',
- qq(
-Welcome to $live->{media}{title}!
+ my @loadfonts;
+ if (defined $theme_name) {
+ @loadfonts = map { "loadfont \${prefix}/themes/$theme_name/$_" } @$theme_fonts;
+ }
-The command line can be used to specify kernel options.
+ my $boot_dir = $live->get_media_prefix('boot');
-$live->{media}{title} <kernel options>
+ join("\n",
+ "search --no-floppy --set=root -l '" . $live->{media}->get_media_label . "'",
+ "set prefix=(\$root)" . $live->get_media_prefix('boot') . "/grub2",
+ "",
+ "if loadfont \${prefix}/fonts/unicode.pf2 ; then",
+ " set gfxmode=1024x768,800x600,auto",
+ " set gfxpayload=keep",
+ " terminal_output gfxterm",
+ "fi",
+ "",
+ if_($theme_name,
+ "if [ x\${uefi} == 'xtrue' ] ; then",
+ " set theme=\${prefix}/themes/$theme_name/theme-uefi.txt",
+ "else",
+ " set theme=\${prefix}/themes/$theme_name/theme.txt",
+ "fi",
+ "export theme",
+ @loadfonts,
+ ),
+ "",
+ "set timeout=" . get_bootloader_timeout($live),
+ "set default=" . get_bootloader_default($live),
+ "",
+ (map {
+ my ($name, $cmdline) = @$_;
+ join("\n",
+ "menuentry '$name' {",
+ " linux $boot_dir/vmlinuz " . get_default_append($live) . if_($cmdline, " $cmdline"),
+ " initrd $boot_dir/initrd.gz",
+ "}"
+ );
+ } group_by2(@{$live->{media}{bootloader_entries}})),
+ "",
+ );
+}
-));
+sub get_bootloader_timeout {
+ my ($live) = @_;
+ defined $live->{media}{bootloader_timeout} ? $live->{media}{bootloader_timeout} : 4;
}
-sub create_efi_boot_image {
+sub get_bootloader_default {
my ($live) = @_;
- my $src_dir = $live->get_builddir . $live->{prefix}{build}{files} . '/EFI';
- my $dst_dir = $live->get_builddir . $live->{prefix}{build}{files} . '/boot';
- my $label = $live->{media}->get_media_label;
- run_("sed", "-i", "s/VOLUME_LABEL/$label/g", $src_dir . '/BOOT/grub.cfg');
- mkdir_p($dst_dir);
- my $boot_image = $dst_dir . '/efiboot.img';
- eval { rm_rf($boot_image) };
- run_("/sbin/mkdosfs", "-F12", "-C", $boot_image, "4096");
- run_("mcopy", "-s", "-i", $boot_image, $src_dir, "::");
+ defined $live->{media}{bootloader_default} ? $live->{media}{bootloader_default} : 0;
}
-sub create_media_bootloader {
+sub get_default_append {
my ($live) = @_;
- cp_f($live->get_system_root . '/boot/vmlinuz-' . $live->find_kernel->{version}, $live->get_builddir . $live->{prefix}{build}{boot} . '/vmlinuz');
- foreach my $boot ('', @{$live->{media}{extra_boot}}) {
- my $opts = { boot => $boot };
- output($live->get_builddir . $live->{prefix}{build}{boot} . get_syslinux_path($live->{media}, $opts),
- build_syslinux_cfg($live, $live->{media}, $opts));
- }
+ my $append = $live->{system}{append};
+ join(" ",
+ "root=mgalive:LABEL=" . $live->{media}->get_media_label,
+ if_($append, $append),
+ if_($live->{system}{vga_mode} && $append !~ /\bvga=\b/,
+ "vga=" . $live->{system}{vga_mode}),
+ );
}
-sub create_classical_bootloader {
+sub build_uefi_grub2_cfg {
my ($live) = @_;
- my $initrd_prefix = "/initrd.img";
- my $initrd = $live->get_system_root . $live->get_media_prefix('boot') . $initrd_prefix;
- my $part_idx = $live->{media}->find_boot_partition_index;
- my $oem_rescue_idx = $live->{media}->find_partition_index('OEM_RESCUE');
- output_p($live->get_system_root . '/boot/grub/menu.lst', build_grub_cfg_raw($live, $live->{media}, -e $initrd && $initrd_prefix, { oem_rescue_idx => $oem_rescue_idx }, $part_idx));
+ join("\n",
+ "search --no-floppy --set=root -l '" . $live->{media}->get_media_label . "'",
+ "set prefix=(\$root)" . $live->get_media_prefix('boot') . "/grub2",
+ "",
+ "set uefi=true",
+ "export uefi",
+ "",
+ "configfile \${prefix}/grub.cfg",
+ "",
+ );
}
-sub get_iso_master_path {
- my ($live, $opts) = @_;
- $live->get_builddir . $live->{prefix}{build}{dist} . '/' . $live->get_name . ($opts->{boot} && "-boot-$opts->{boot}") . '.iso';
+sub create_master {
+ my ($live) = @_;
+
+ if (my $create = $live->{media}->get_storage_setting('create')) {
+ $create->($live);
+ } else {
+ warn "not implemented yet\n";
+ }
}
sub create_iso_master {
- my ($live, $opts) = @_;
+ my ($live) = @_;
+
my $label = $live->{media}->get_media_label or die "the source device must be described by a label\n";
- my $dest;
- unless ($opts->{onthefly}) {
- $dest = get_iso_master_path($live, $opts);
- mkdir_p(dirname($dest));
- }
+
+ my $mbr_image = $live->{settings}{config_root} . '/' . $live->{media}{mbr_boot_img};
+
+ my $esp_image = $live->get_builddir . $live->{prefix}{build}{images} . '/esp.img';
+
+ my $dest = $live->get_builddir . $live->{prefix}{build}{dist} . '/' . $live->get_name . '.iso';
+ mkdir_p(dirname($dest));
+
build_iso_image(
$live,
$dest,
- $live->get_builddir . $live->{prefix}{build}{boot} . get_syslinux_path($live->{media}, $opts),
$label,
- $live->get_media_prefix('boot', $opts->{boot}) . '=' . $live->get_builddir . $live->{prefix}{build}{boot},
- if_(!$opts->{boot_only},
- (map {
- $live->get_media_prefix('loopbacks', $opts->{boot}) . $_ .
- '=' .
- $live->get_builddir . $live->{prefix}{build}{loopbacks} . $_;
- } list_selected_loopbacks($live)),
- if_($live->{media}{files},
- map {
- $_ . '=' . $live->get_builddir . $live->{prefix}{build}{files} . '/' . $_;
- } all($live->get_builddir . $live->{prefix}{build}{files})
- ),
+ $mbr_image,
+ $esp_image,
+ $live->get_media_prefix('boot') . '=' . $live->get_builddir . $live->{prefix}{build}{boot},
+ if_($live->{settings}{arch} eq 'x86_64',
+ $live->get_media_prefix('EFI') . '=' . $live->get_builddir . $live->{prefix}{build}{EFI},
+ ),
+ (
+ map {
+ $live->get_media_prefix('loopbacks') . $_ .
+ '=' .
+ $live->get_builddir . $live->{prefix}{build}{loopbacks} . $_;
+ } list_selected_loopbacks($live)
+ ),
+ if_($live->{media}{files},
+ map {
+ $_ . '=' . $live->get_builddir . $live->{prefix}{build}{files} . '/' . $_;
+ } all($live->get_builddir . $live->{prefix}{build}{files})
),
);
}
sub build_iso_image {
- my ($live, $dest, $isolinux_cfg, $label, @opts) = @_;
-
- my $progress = MDV::Draklive::Progress->new(100, time());
- my $in_progress;
- autoflush STDOUT 1;
- local $_;
- run_foreach(sub {
- if (/^\s*([0-9.]+)%\s*done,/) {
- $progress->{current} = int($1);
- $progress->show(time());
- $in_progress = 1;
- } else {
- print "\n" if $in_progress;
- print $_;
- $in_progress = 0;
- }
- },
- 'xorriso', '-as', 'mkisofs', '-pad', '-l', '-R', '-J',
- '-V', $label, #'-A', $application, '-p', $preparer, '-P', $publisher,
- '-b', 'isolinux/isolinux.bin',
- '-c', 'isolinux/boot.cat',
- '-hide-rr-moved', '-no-emul-boot',
- '-boot-load-size', 4, '-boot-info-table',
- '-graft-points',
- if_($live->{settings}{arch} =~ /x86_64/, '-eltorito-alt-boot', '-e', 'boot/efiboot.img', '-no-emul-boot'),
- if_($dest, '-o', $dest),
- 'isolinux=' . $live->get_builddir . $live->{prefix}{build}{boot} . '/syslinux',
- 'isolinux/isolinux.cfg=' . $isolinux_cfg,
- 'isolinux/isolinux.bin=/usr/lib/syslinux/isolinux.bin',
- 'isolinux/chain.c32=/usr/lib/syslinux/chain.c32',
- 'isolinux/gfxboot.c32=/usr/lib/syslinux/gfxboot.c32',
- 'isolinux/ldlinux.c32=/usr/lib/syslinux/ldlinux.c32',
- 'isolinux/libcom32.c32=/usr/lib/syslinux/libcom32.c32',
- 'isolinux/libgpl.c32=/usr/lib/syslinux/libgpl.c32',
- 'isolinux/libmenu.c32=/usr/lib/syslinux/libmenu.c32',
- 'isolinux/libutil.c32=/usr/lib/syslinux/libutil.c32',
- @opts,
- ) or die "unable to run xorriso\n";
- autoflush STDOUT 0;
- $progress->end;
+ my ($live, $dest, $label, $mbr_image, $esp_image, @opts) = @_;
+
+ my $boot = $live->get_media_prefix('boot');
+ my $EFI = $live->get_media_prefix('EFI');
+
+ run_('xorrisofs',
+ '-pad', '-l', '-R', '-J',
+ '-V', $label,
+ '-graft-points',
+ '-hide-rr-moved',
+ '--sort-weight', 0, '/',
+ '--sort-weight', 1, $boot,
+ # for hybrid MBR boot
+ '--grub2-mbr', $mbr_image,
+ '-b', "$boot/grub2/eltorito.img",
+ '-no-emul-boot',
+ '-boot-load-size', 4,
+ '-boot-info-table',
+ '--grub2-boot-info',
+ if_($live->{settings}{arch} eq 'x86_64',
+ # for DVD UEFI boot
+ '-eltorito-alt-boot',
+ '-e', "$EFI/BOOT/bootx64.efi",
+ '-no-emul-boot',
+ # for USB UEFI boot
+ '-part_like_isohybrid',
+ '-iso_mbr_part_type', '0x00',
+ '-append_partition', 2, '0xef', $esp_image,
+ ),
+ if_($dest, '-o', $dest),
+ @opts,
+ ) or die "unable to run xorrisofs\n";
if ($dest) {
my $dir = dirname($dest);
my $filename = basename($dest);
- run_('isohybrid', ($live->{settings}{arch} =~ /x86_64/ ? '-u' : '-o 1'), $dest);
run_('mgaiso-addmd5', '>', '/dev/null', '2>', '/dev/null', $dest);
run_({ chdir => $dir }, 'md5sum', '>', $dest . '.md5', $filename);
run_({ chdir => $dir }, 'sha1sum', '>', $dest . '.sha1', $filename);
@@ -778,24 +668,6 @@ sub build_iso_image {
}
}
-#- $opts:
-#- media: alternate media
-#- onthefly : if true, the create function must output to stdout
-sub create_master {
- my ($live, $opts) = @_;
-
- if (my $create = $live->{media}->get_boot_setting('create', $opts)) {
- $create->($live, $opts);
- } else {
- warn "not implemented yet\n";
- }
-}
-
-sub maybe_umount_device {
- my ($device) = @_;
- run_('umount', $device) if cat_('/proc/mounts') =~ m!^$device\s+!m;
-}
-
sub clean {
my ($live) = @_;
# umount filesystem in the live before cleaning
@@ -819,13 +691,11 @@ my @all = qw(install boot loop master);
die "you must be root to run this program\n" if $>;
my $live_object = 'MDV::Draklive::Live'->new;
-my %opts;
my $config_root = $MDV::Draklive::Config::default_config_root;
my $config_path = $MDV::Draklive::Config::default_config_path;
my $settings_path = $MDV::Draklive::Config::default_settings_path;
GetOptions(
"help" => sub { Pod::Usage::pod2usage('-verbose' => 1) },
- "boot-only" => \$opts{boot_only},
"all" => sub { $_->{to_run} = 1 foreach grep { member($_->{name}, @all) } @actions },
(map { $_->{name} => \$_->{to_run} } @actions),
"all-regions" => sub { $live_object->{all_regions} = 1 },
@@ -845,7 +715,7 @@ require standalone;
$live_object->{settings}{region} = $region;
foreach (grep { $_->{to_run} } @actions) {
print qq(* entering step "$_->{name}"\n);
- $_->{do}->($live_object, \%opts);
+ $_->{do}->($live_object);
print qq(* step "$_->{name}" done\n);
}
}
@@ -891,9 +761,6 @@ draklive [options]
--all-regions proceed with all configured regions
- --boot-only copy only boot files
- (affects master/record steps)
-
Examples:
draklive --clean
diff --git a/lib/MDV/Draklive/Config.pm b/lib/MDV/Draklive/Config.pm
index 99ca16a..dfbb596 100644
--- a/lib/MDV/Draklive/Config.pm
+++ b/lib/MDV/Draklive/Config.pm
@@ -48,15 +48,18 @@ sub complete_config {
my $default_prefix = {
build => {
+ EFI => '/EFI',
boot => '/boot',
- files => '/files',
dist => '/dist',
+ files => '/files',
+ images => '/images',
initrd => '/initrd',
loopbacks => '/loopbacks',
modules => '/modules',
scripts => '/scripts',
},
media => {
+ EFI => '/EFI',
boot => '/boot',
hidden_boot => '/.boot',
loopbacks => '/loopbacks',
diff --git a/lib/MDV/Draklive/Storage.pm b/lib/MDV/Draklive/Storage.pm
index 0bf1fa9..e531dc7 100644
--- a/lib/MDV/Draklive/Storage.pm
+++ b/lib/MDV/Draklive/Storage.pm
@@ -6,7 +6,6 @@ our %storage_types = (
iso => {
modules => 'bus/firewire|usb disk/firewire|hardware_raid|ide|sata|scsi|usb',
fs => 'iso9660',
- can_hide => 0,
source => 'LABEL=MDVISOROOT',
read_only => 1,
create => \&main::create_iso_master,