Archived
1
0
Fork 0

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.
This commit is contained in:
Maxim Cournoyer 2020-02-19 15:59:06 -05:00
parent aaffde38b5
commit 6794653e1b
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -36,6 +36,7 @@
#:use-module (ice-9 match) #:use-module (ice-9 match)
#:use-module (ice-9 regex) #:use-module (ice-9 regex)
#:use-module (srfi srfi-1) #:use-module (srfi srfi-1)
#:use-module (srfi srfi-2)
#:export (grub-image #:export (grub-image
grub-image? grub-image?
grub-image-aspect-ratio 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 background image and fonts must be searched for. SYSTEM must be the target
system string---e.g., \"x86_64-linux\"." system string---e.g., \"x86_64-linux\"."
(define setup-gfxterm-body (define setup-gfxterm-body
;; Intel and EFI systems need to be switched into graphics mode, whereas (let ((gfxmode
;; most other modern architectures have no other mode and therefore don't (or (and-let* ((theme (bootloader-configuration-theme config))
;; need to be switched. (gfxmode (grub-gfxmode theme)))
(if (string-match "^(x86_64|i[3-6]86)-" system) (string-join gfxmode ";"))
(string-append "auto")))
"
" ;; Intel and EFI systems need to be switched into graphics mode, whereas
(let ((gfxmode (and=> ;; most other modern architectures have no other mode and therefore
(and=> config bootloader-configuration-theme) ;; don't need to be switched.
grub-gfxmode)))
(if gfxmode ;; XXX: Do we really need to restrict to x86 systems? We could imitate
(string-append "set gfxmode=" (string-join gfxmode ";")) ;; what the GRUB default configuration does and decide based on whether
"# Leave 'gfxmode' to 'auto'.")) ;; 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 all_video
insmod gfxterm insmod gfxterm~%" gfxmode)
") "")))
""))
(define (setup-gfxterm config font-file) (define (setup-gfxterm config font-file)
(if (memq 'gfxterm (bootloader-configuration-terminal-outputs config)) (if (memq 'gfxterm (bootloader-configuration-terminal-outputs config))