summaryrefslogtreecommitdiff
path: root/gnu/bootloader
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2020-02-19 15:59:06 -0500
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2020-03-17 23:09:14 -0400
commit6794653e1b0fce8981eb179b9d4cab4a0c5f926f (patch)
tree57b6a176ae787c114ff6c6269e48587d065021b4 /gnu/bootloader
parentaaffde38b54c978e2425fa88eea733dc80f87444 (diff)
downloadpatches-6794653e1b0fce8981eb179b9d4cab4a0c5f926f.tar
patches-6794653e1b0fce8981eb179b9d4cab4a0c5f926f.tar.gz
bootloader: grub: Refactor eye-candy a bit.
* gnu/bootloader/grub.scm (eye-candy)[setup-gfxterm-body]: Define the GFXMODE binding using AND-LET* instead of chained AND=>. Add a comment about supporting graphical mode on other systems than x86. Generate configuration string using FORMAT rather than STRING-APPEND.
Diffstat (limited to 'gnu/bootloader')
-rw-r--r--gnu/bootloader/grub.scm37
1 files changed, 20 insertions, 17 deletions
diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index 36a964e8f5..28e6cb1f5f 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -36,6 +36,7 @@
#:use-module (ice-9 match)
#:use-module (ice-9 regex)
#:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-2)
#:export (grub-image
grub-image?
grub-image-aspect-ratio
@@ -149,24 +150,26 @@ STORE-MOUNT-POINT is its mount point; these are used to determine where the
background image and fonts must be searched for. SYSTEM must be the target
system string---e.g., \"x86_64-linux\"."
(define setup-gfxterm-body
- ;; Intel and EFI systems need to be switched into graphics mode, whereas
- ;; most other modern architectures have no other mode and therefore don't
- ;; need to be switched.
- (if (string-match "^(x86_64|i[3-6]86)-" system)
- (string-append
- "
-"
- (let ((gfxmode (and=>
- (and=> config bootloader-configuration-theme)
- grub-gfxmode)))
- (if gfxmode
- (string-append "set gfxmode=" (string-join gfxmode ";"))
- "# Leave 'gfxmode' to 'auto'."))
- "
+ (let ((gfxmode
+ (or (and-let* ((theme (bootloader-configuration-theme config))
+ (gfxmode (grub-gfxmode theme)))
+ (string-join gfxmode ";"))
+ "auto")))
+
+ ;; Intel and EFI systems need to be switched into graphics mode, whereas
+ ;; most other modern architectures have no other mode and therefore
+ ;; don't need to be switched.
+
+ ;; XXX: Do we really need to restrict to x86 systems? We could imitate
+ ;; what the GRUB default configuration does and decide based on whether
+ ;; a user provided 'gfxterm' in the terminal-outputs field of their
+ ;; bootloader-configuration record.
+ (if (string-match "^(x86_64|i[3-6]86)-" system)
+ (format #f "
+ set gfxmode=~a
insmod all_video
- insmod gfxterm
-")
- ""))
+ insmod gfxterm~%" gfxmode)
+ "")))
(define (setup-gfxterm config font-file)
(if (memq 'gfxterm (bootloader-configuration-terminal-outputs config))