summary refs log tree commit diff
path: root/nixos/modules/system/boot/loader/grub
diff options
context:
space:
mode:
authorvolth <volth@webmaster.ms>2018-09-02 12:34:55 +0000
committerxeji <36407913+xeji@users.noreply.github.com>2018-09-02 14:34:55 +0200
commita9a8043b9bea34e86bfd15122cebef30a1acc157 (patch)
treeb6d55c6a15b99873b4d6ae640b356e9b423c6b10 /nixos/modules/system/boot/loader/grub
parent6a7cd7888471509a0744e7a764773d605ea3c6c5 (diff)
downloadnixlib-a9a8043b9bea34e86bfd15122cebef30a1acc157.tar
nixlib-a9a8043b9bea34e86bfd15122cebef30a1acc157.tar.gz
nixlib-a9a8043b9bea34e86bfd15122cebef30a1acc157.tar.bz2
nixlib-a9a8043b9bea34e86bfd15122cebef30a1acc157.tar.lz
nixlib-a9a8043b9bea34e86bfd15122cebef30a1acc157.tar.xz
nixlib-a9a8043b9bea34e86bfd15122cebef30a1acc157.tar.zst
nixlib-a9a8043b9bea34e86bfd15122cebef30a1acc157.zip
install-grub.pl: avoid double '/' in menu.lst and grub.conf (#45907)
Although double '/' in paths is not a problem for GRUB supplied with nixpkgs, sometimes NixOS's grub.conf read by external GRUB and there are versions of GRUB which fail
Diffstat (limited to 'nixos/modules/system/boot/loader/grub')
-rw-r--r--nixos/modules/system/boot/loader/grub/install-grub.pl8
1 files changed, 4 insertions, 4 deletions
diff --git a/nixos/modules/system/boot/loader/grub/install-grub.pl b/nixos/modules/system/boot/loader/grub/install-grub.pl
index ea6e56892cb3..bda6a3136407 100644
--- a/nixos/modules/system/boot/loader/grub/install-grub.pl
+++ b/nixos/modules/system/boot/loader/grub/install-grub.pl
@@ -248,7 +248,7 @@ if ($grubVersion == 1) {
     ";
     if ($splashImage) {
         copy $splashImage, "$bootPath/background.xpm.gz" or die "cannot copy $splashImage to $bootPath\n";
-        $conf .= "splashimage " . $grubBoot->path . "/background.xpm.gz\n";
+        $conf .= "splashimage " . ($grubBoot->path eq "/" ? "" : $grubBoot->path) . "/background.xpm.gz\n";
     }
 }
 
@@ -289,7 +289,7 @@ else {
         copy $font, "$bootPath/converted-font.pf2" or die "cannot copy $font to $bootPath\n";
         $conf .= "
             insmod font
-            if loadfont " . $grubBoot->path . "/converted-font.pf2; then
+            if loadfont " . ($grubBoot->path eq "/" ? "" : $grubBoot->path) . "/converted-font.pf2; then
               insmod gfxterm
               if [ \"\${grub_platform}\" = \"efi\" ]; then
                 set gfxmode=$gfxmodeEfi
@@ -317,7 +317,7 @@ else {
         copy $splashImage, "$bootPath/background$suffix" or die "cannot copy $splashImage to $bootPath\n";
         $conf .= "
             insmod " . substr($suffix, 1) . "
-            if background_image --mode '$splashMode' " . $grubBoot->path . "/background$suffix; then
+            if background_image --mode '$splashMode' " . ($grubBoot->path eq "/" ? "" : $grubBoot->path) . "/background$suffix; then
               set color_normal=white/black
               set color_highlight=black/white
             else
@@ -352,7 +352,7 @@ sub copyToKernelsDir {
         rename $tmp, $dst or die "cannot rename $tmp to $dst\n";
     }
     $copied{$dst} = 1;
-    return $grubBoot->path . "/kernels/$name";
+    return ($grubBoot->path eq "/" ? "" : $grubBoot->path) . "/kernels/$name";
 }
 
 sub addEntry {