aboutsummaryrefslogtreecommitdiff
path: root/gnu/system
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-09-26 00:12:50 +0900
committerLudovic Courtès <ludo@gnu.org>2016-09-26 00:18:39 +0900
commit5babe521c8adc722c2411b255cbeeef308339d06 (patch)
treeeeae5965961fab467e65f830e73bc210cd16ffe0 /gnu/system
parent7acd71d13d22fd318b3f136e344ba86bc62521fb (diff)
downloadgnu-guix-5babe521c8adc722c2411b255cbeeef308339d06.tar
gnu-guix-5babe521c8adc722c2411b255cbeeef308339d06.tar.gz
system: Don't emit a GRUB 'search' command when passed a GRUB file name.
Reported by Tomáš Čech <tcech@suse.com> at <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20067#26>. * gnu/system/grub.scm (grub-root-search): Don't emit anything when FILE is a string that does not denote an absolute file name.
Diffstat (limited to 'gnu/system')
-rw-r--r--gnu/system/grub.scm29
1 files changed, 17 insertions, 12 deletions
diff --git a/gnu/system/grub.scm b/gnu/system/grub.scm
index 3d294284e4..ead48f0e32 100644
--- a/gnu/system/grub.scm
+++ b/gnu/system/grub.scm
@@ -234,18 +234,23 @@ fi~%"
"Return the GRUB 'search' command to look for ROOT-FS, which contains FILE,
a gexp. The result is a gexp that can be inserted in the grub.cfg-generation
code."
- (case (file-system-title root-fs)
- ;; Preferably refer to ROOT-FS by its UUID or label. This is more
- ;; efficient and less ambiguous, see <>.
- ((uuid)
- (format #f "search --fs-uuid --set ~a"
- (uuid->string (file-system-device root-fs))))
- ((label)
- (format #f "search --label --set ~a"
- (file-system-device root-fs)))
- (else
- ;; As a last resort, look for any device containing FILE.
- #~(format #f "search --file --set ~a" #$file))))
+ ;; Usually FILE is a file name gexp like "/gnu/store/…-linux/vmlinuz", but
+ ;; it can also be something like "(hd0,msdos1)/vmlinuz" in the case of
+ ;; custom menu entries. In the latter case, don't emit a 'search' command.
+ (if (and (string? file) (not (string-prefix? "/" file)))
+ ""
+ (case (file-system-title root-fs)
+ ;; Preferably refer to ROOT-FS by its UUID or label. This is more
+ ;; efficient and less ambiguous, see <>.
+ ((uuid)
+ (format #f "search --fs-uuid --set ~a"
+ (uuid->string (file-system-device root-fs))))
+ ((label)
+ (format #f "search --label --set ~a"
+ (file-system-device root-fs)))
+ (else
+ ;; As a last resort, look for any device containing FILE.
+ #~(format #f "search --file --set ~a" #$file)))))
(define* (grub-configuration-file config store-fs entries
#:key