diff options
-rwxr-xr-x | draklive2 | 28 |
1 files changed, 15 insertions, 13 deletions
@@ -489,8 +489,10 @@ sub create_bootloader { my $label = $live->{media}->get_media_label; my $grub2_cfg = $grub2_dir . '/grub.cfg'; - if ($live->{media}{grub2_cfg}) { - cp_f($live->{settings}{config_root} . '/' . $live->{media}{grub2_cfg}, $grub2_cfg); + if (defined $live->{media}{grub2_cfg}) { + my $grub_cfg_template = get_absolute_path($live, $live->{media}{grub2_cfg}); + -e $grub_cfg_template or die "cannot find grub2 config file $grub_cfg_template\n"; + cp_f($grub_cfg_template, $grub2_cfg); run_("sed", "-i", "s/VOLUME_LABEL/$label/g", $grub2_cfg); } else { output($grub2_cfg, build_grub2_cfg($live, $theme_name, \@theme_fonts, $add_lang_menu)); @@ -586,7 +588,7 @@ sub build_grub2_cfg { my @loadfonts; if (defined $theme_name) { - @loadfonts = map { "loadfont \${prefix}/themes/$theme_name/$_" } @$theme_fonts; + @loadfonts = map { "loadfont \$prefix/themes/$theme_name/$_" } @$theme_fonts; } my @langs = get_langs($live); @@ -599,24 +601,24 @@ sub build_grub2_cfg { "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", + "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", + "if [ x\$uefi == 'xtrue' ] ; then", + " set theme=\$prefix/themes/$theme_name/theme-uefi.txt", "else", - " set theme=\${prefix}/themes/$theme_name/theme.txt", + " set theme=\$prefix/themes/$theme_name/theme.txt", "fi", "export theme", @loadfonts, ), "", - "set timeout=" . get_bootloader_timeout($live), "set default=" . get_bootloader_default($live), + "set timeout=" . get_bootloader_timeout($live), "", if_($add_lang_menu, "if [ -z \$lang ] ; then", @@ -642,14 +644,14 @@ sub build_grub2_cfg { ); } -sub get_bootloader_timeout { +sub get_bootloader_default { my ($live) = @_; - defined $live->{media}{bootloader_timeout} ? $live->{media}{bootloader_timeout} : 4; + defined $live->{media}{bootloader_default} ? $live->{media}{bootloader_default} : 0; } -sub get_bootloader_default { +sub get_bootloader_timeout { my ($live) = @_; - defined $live->{media}{bootloader_default} ? $live->{media}{bootloader_default} : 0; + defined $live->{media}{bootloader_timeout} ? $live->{media}{bootloader_timeout} : 4; } sub get_default_append { @@ -691,7 +693,7 @@ sub build_uefi_grub2_cfg { "set uefi=true", "export uefi", "", - "configfile \${prefix}/grub.cfg", + "configfile \$prefix/grub.cfg", "", ); } |