summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2018-10-23 20:07:58 +0100
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2018-10-28 21:45:52 +0000
commitb4ace6cb70f12af823200af7204a87690595a85c (patch)
tree19403077f6025c76dea710b33e537443d12af93c
parent8ea372b5ceb442e389fb3df542c72f665bbdcbdf (diff)
downloaddrakiso-b4ace6cb70f12af823200af7204a87690595a85c.tar
drakiso-b4ace6cb70f12af823200af7204a87690595a85c.tar.gz
drakiso-b4ace6cb70f12af823200af7204a87690595a85c.tar.bz2
drakiso-b4ace6cb70f12af823200af7204a87690595a85c.tar.xz
drakiso-b4ace6cb70f12af823200af7204a87690595a85c.zip
BuildBoot: add option to boot live system kernel from persistent overlay.
-rw-r--r--lib/MGA/DrakISO/BuildBoot.pm46
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 {