me
/
guix
Archived
1
0
Fork 0

bootloader: Use 'invoke/quiet' when running 'grub-install' and co.

This hides potentially confusing GRUB messages from the user, such as
"Installing for i386-pc platform."

* gnu/bootloader/extlinux.scm (install-extlinux): Use 'invoke/quiet'
instead of 'system*' and 'error'.
* gnu/bootloader/grub.scm (install-grub, install-grub-efi): Likewise.
* guix/scripts/system.scm (bootloader-installer-script): Guard against
'message-condition?' and handle them properly.
master
Ludovic Courtès 2019-03-16 17:09:19 +01:00
parent f0cc5e7e1e
commit 21fcfe1ee9
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
3 changed files with 22 additions and 15 deletions

View File

@ -91,11 +91,9 @@ TIMEOUT ~a~%"
(for-each (lambda (file) (for-each (lambda (file)
(install-file file install-dir)) (install-file file install-dir))
(find-files syslinux-dir "\\.c32$")) (find-files syslinux-dir "\\.c32$"))
(unless (invoke/quiet extlinux "--install" install-dir)
(and (zero? (system* extlinux "--install" install-dir)) (write-file-on-device (string-append syslinux-dir "/" #$mbr)
(write-file-on-device 440 device 0))))
(string-append syslinux-dir "/" #$mbr) 440 device 0))
(error "failed to install SYSLINUX")))))
(define install-extlinux-mbr (define install-extlinux-mbr
(install-extlinux "mbr.bin")) (install-extlinux "mbr.bin"))

View File

@ -369,10 +369,11 @@ submenu \"GNU system, old configurations...\" {~%")
;; root partition. ;; root partition.
(setenv "GRUB_ENABLE_CRYPTODISK" "y") (setenv "GRUB_ENABLE_CRYPTODISK" "y")
(unless (zero? (system* grub "--no-floppy" "--target=i386-pc" ;; Hide potentially confusing messages from the user, such as
;; "Installing for i386-pc platform."
(invoke/quiet grub "--no-floppy" "--target=i386-pc"
"--boot-directory" install-dir "--boot-directory" install-dir
device)) device))))
(error "failed to install GRUB (BIOS)")))))
(define install-grub-efi (define install-grub-efi
#~(lambda (bootloader efi-dir mount-point) #~(lambda (bootloader efi-dir mount-point)
@ -388,10 +389,9 @@ submenu \"GNU system, old configurations...\" {~%")
;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or ;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or
;; root partition. ;; root partition.
(setenv "GRUB_ENABLE_CRYPTODISK" "y") (setenv "GRUB_ENABLE_CRYPTODISK" "y")
(unless (zero? (system* grub-install "--boot-directory" install-dir (invoke/quiet grub-install "--boot-directory" install-dir
"--bootloader-id=Guix" "--bootloader-id=Guix"
"--efi-directory" target-esp)) "--efi-directory" target-esp))))
(error "failed to install GRUB (EFI)")))))

View File

@ -808,8 +808,17 @@ and TARGET arguments."
#~(begin #~(begin
(use-modules (gnu build bootloader) (use-modules (gnu build bootloader)
(guix build utils) (guix build utils)
(ice-9 binary-ports)) (ice-9 binary-ports)
(#$installer #$bootloader #$device #$target))))) (srfi srfi-34)
(srfi srfi-35))
(guard (c ((message-condition? c) ;XXX: i18n
(format (current-error-port) "error: ~a~%"
(condition-message c))
(exit 1)))
(#$installer #$bootloader #$device #$target)
(format #t "bootloader successfully installed on '~a'~%"
device))))))
(define* (perform-action action os (define* (perform-action action os
#:key skip-safety-checks? #:key skip-safety-checks?