diff options
author | Martin Whitaker <mageia@martin-whitaker.me.uk> | 2017-12-22 00:27:49 +0000 |
---|---|---|
committer | Martin Whitaker <mageia@martin-whitaker.me.uk> | 2017-12-22 00:28:31 +0000 |
commit | fcdc9d5967cbf861db391a777bb129afc2e2560b (patch) | |
tree | 68e13a27e47122ec4dcce465fe64323f745a8ea2 /lib/MGA/DrakISO/BuildBoot.pm | |
parent | b52888b09904b607c8351da18affaf19e3690ee9 (diff) | |
download | drakiso-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/BuildBoot.pm')
-rwxr-xr-x | lib/MGA/DrakISO/BuildBoot.pm | 61 |
1 files changed, 44 insertions, 17 deletions
diff --git a/lib/MGA/DrakISO/BuildBoot.pm b/lib/MGA/DrakISO/BuildBoot.pm index 2038538..bfa6042 100755 --- a/lib/MGA/DrakISO/BuildBoot.pm +++ b/lib/MGA/DrakISO/BuildBoot.pm @@ -159,7 +159,7 @@ sub prepare_iso_bootloader { build_grub2_eltorito_img($grub2_dir . '/eltorito.img'); } - my $label = $build->{media}->get_media_label; + my $label = $build->{media}{label}; # If the user has supplied a top-level grub2 configuration file, copy that # (replacing the "VOLUME_LABEL" template with the actual label for the ISO @@ -175,12 +175,13 @@ sub prepare_iso_bootloader { } my $title = $build->{media}{bootloader_title} // $label =~ s/-/ /gr; + my $mode = $build->{settings}{arch} eq 'x86_64' ? '64-bit' : '32-bit'; # If we have a theme, replace the menu title with the name of the ISO # (extracted from the disk label). my $base_theme_txt = $grub2_dir . "/themes/$theme_name/theme.txt"; if (-e $base_theme_txt) { - run_('sed', '-i', qq(s/title-text:.*/title-text: "$title"/), $base_theme_txt); + run_('sed', '-i', qq(s/title-text:.*/title-text: "$title ($mode)"/), $base_theme_txt); } # If we are building a 32-bit ISO, we are done, as we don't support @@ -230,8 +231,9 @@ sub prepare_iso_bootloader { sub build_grub2_eltorito_img { my ($output) = @_; - my @modules = qw(biosdisk iso9660 fat part_msdos all_video font png gfxterm gfxmenu linux - keylayouts at_keyboard usb_keyboard configfile echo gettext ls search test); + my @modules = qw(biosdisk iso9660 fat part_msdos all_video font png gfxterm gfxmenu + keylayouts at_keyboard usb_keyboard configfile echo gettext + linux linux16 ls search test); run_('grub2-mkimage', '--output', $output, @@ -244,8 +246,9 @@ sub build_grub2_eltorito_img { sub build_grub2_bootx64_efi { my ($output) = @_; - my @modules = qw(iso9660 fat part_msdos all_video font png gfxterm gfxmenu linux - keylayouts at_keyboard usb_keyboard configfile echo gettext ls search test); + my @modules = qw(iso9660 fat part_msdos all_video font png gfxterm gfxmenu + keylayouts at_keyboard usb_keyboard configfile echo gettext + linux linux16 ls search test); run_('grub2-mkimage', '--output', $output, @@ -267,7 +270,7 @@ sub build_grub2_cfg { join("\n", "if [ -z \$initialised ] ; then", - " search --no-floppy --set=root -l '" . $build->{media}->get_media_label . "'", + " search --no-floppy --set=root -l '" . $build->{media}{label} . "'", " set prefix=(\$root)/boot/grub2", "", " if loadfont \$prefix/fonts/unicode.pf2 ; then", @@ -302,12 +305,27 @@ sub build_grub2_cfg { "", ), (map { - my ($name, $cmdline) = @$_; + my ($name, $options) = @$_; + my $command = $options->{command} // 'linux'; + my $image = $options->{image} // get_default_image($build, $name); + my $initrd = $options->{initrd} // get_default_initrd($build); + my $append = $options->{append}; + + my $initrd_command = $command eq 'linux16 ' ? 'initrd16' : 'initrd'; + join("\n", + if_($command eq 'linux16', + "if [ x\$uefi != 'xtrue' ] ; then", # UEFI doesn't support 16-bit + ), "menuentry $gettext\"$name\" {", - " linux /boot/vmlinuz " . get_default_append($build) . if_($cmdline, " $cmdline"), - " initrd /boot/initrd.gz", - "}" + " $command $image " . join(' ', get_default_append($build), $append), + if_($initrd, + " $initrd_command $initrd", + ), + "}", + if_($command eq 'linux16', + "fi", + ), ); } group_by2(@{$build->{media}{bootloader_entries}})), if_($add_lang_menu || $add_kbd_menu, @@ -340,15 +358,24 @@ sub get_bootloader_timeout { defined $build->{media}{bootloader_timeout} ? $build->{media}{bootloader_timeout} : 4; } +sub get_default_image { + my ($build, $name) = @_; + -e ($build->get_builddir('boot') . '/vmlinuz') && '/boot/vmlinuz' + or die "ERROR: no boot image found for '$name' boot entry\n"; +} + +sub get_default_initrd { + my ($build) = @_; + -e ($build->get_builddir('boot') . '/initrd,gz') && '/boot/initrd.gz' || + -e ($build->get_builddir('boot') . '/all.rdz') && '/boot/all.rdz'; +} + sub get_default_append { my ($build) = @_; - my $append = $build->{system}{append}; join(" ", - "root=mgalive:LABEL=" . $build->{media}->get_media_label, "lang=\$lang kbd=\$kbd", - if_($append, $append), - if_($build->{system}{vga_mode} && $append !~ /\bvga=\b/, - "vga=" . $build->{system}{vga_mode}), + if_($build->{system}{append}, $build->{system}{append}), + if_($build->{system}{vga_mode}, "vga=" . $build->{system}{vga_mode}), ); } @@ -407,7 +434,7 @@ sub build_kbd_menu_cfg { sub build_uefi_grub2_cfg { my ($build) = @_; join("\n", - "search --no-floppy --set=root -l '" . $build->{media}->get_media_label . "'", + "search --no-floppy --set=root -l '" . $build->{media}{label} . "'", "set prefix=(\$root)/boot/grub2", "", "set uefi=true", |