diff options
Diffstat (limited to 'lib/MGA/DrakISO/BuildBoot.pm')
-rw-r--r-- | lib/MGA/DrakISO/BuildBoot.pm | 46 |
1 files changed, 41 insertions, 5 deletions
diff --git a/lib/MGA/DrakISO/BuildBoot.pm b/lib/MGA/DrakISO/BuildBoot.pm index 9c28a53..f3b57a9 100644 --- a/lib/MGA/DrakISO/BuildBoot.pm +++ b/lib/MGA/DrakISO/BuildBoot.pm @@ -80,7 +80,7 @@ sub prepare_live_system_boot { or die "ERROR: cannot chmod initrd\n"; # Move the initrd into the build directory. - run_as_root('mv', $root . $initrd, $boot_dir . '/initrd.gz') + run_as_root('mv', $root . $initrd, $boot_dir . '/initrd.img') or die "ERROR: cannot move initrd\n"; } catch { $error_message = $_; @@ -325,6 +325,20 @@ sub build_grub2_cfg { " set grub2=(\$root)/boot/grub2", " export grub2", "", + if_($build->{media}{overlay_label}, + " set kernel=no_choice", + " export kernel", + "", + " search --no-floppy --set=overlay -l '" . $build->{media}{overlay_label} . "'", + " export overlay", + " if [ ! -z \$overlay ] ; then", + " search --no-floppy --set=partition -f /memory/boot/vmlinuz --hint \$overlay", + " if [ x\$partition == x\$overlay ] ; then", + " set kernel=latest", + " fi", + " fi", + "", + ), " if loadfont \$grub2/fonts/unicode.pf2 ; then", " set gfxmode=1024x768,800x600,auto", " set gfxpayload=keep", @@ -344,6 +358,13 @@ sub build_grub2_cfg { " export initialised", "fi", "", + "set boot=/boot", + if_($build->{media}{overlay_label}, + "if [ \$kernel == 'latest' ] ; then", + " set boot=(\$overlay)/memory/boot", + "fi", + ), + "", "set default=" . get_bootloader_default($build), "set timeout=" . get_bootloader_timeout($build), "", @@ -380,12 +401,27 @@ sub build_grub2_cfg { ), ); } group_by2(@{$build->{media}{bootloader_entries}})), - if_($add_lang_menu || $add_kbd_menu, + if_($build->{media}{overlay_label} || $add_lang_menu || $add_kbd_menu, # this acts as a spacer "menuentry '________________________' {", " set dummy=true", "}", ), + if_($build->{media}{overlay_label}, + "if [ \$kernel != 'no_choice' ] ; then", + " if [ \$kernel == 'latest' ] ; then", + " menuentry \"F1: \"$gettext\"Kernel [latest]\" --id kernel --hotkey f1 {", + " set kernel=original", + " configfile \$grub2/grub.cfg", + " }", + " else", + " menuentry \"F1: \"$gettext\"Kernel [original]\" --id kernel --hotkey f1 {", + " set kernel=latest", + " configfile \$grub2/grub.cfg", + " }", + " fi", + "fi", + ), if_($add_lang_menu, "submenu \"F2: \"$gettext\"Language [\$lang]\" --id language --hotkey f2 {", " source \$grub2/lang-menu.cfg", @@ -412,14 +448,14 @@ sub get_bootloader_timeout { sub get_default_image { my ($build, $name) = @_; - -e ($build->get_build_dir('boot') . '/vmlinuz') && '/boot/vmlinuz' + -e ($build->get_build_dir('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_build_dir('boot') . '/initrd.gz') && '/boot/initrd.gz' || - -e ($build->get_build_dir('boot') . '/all.rdz') && '/boot/all.rdz'; + -e ($build->get_build_dir('boot') . '/initrd.img') && '$boot/initrd.img' || + -e ($build->get_build_dir('boot') . '/all.rdz') && '$boot/all.rdz'; } sub get_default_append { |