guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: guix-commits
Subject: 03/03: bootloader: Use 'invoke/quiet' when running 'grub-install' and co.
Date: Sat, 16 Mar 2019 13:15:27 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 21fcfe1ee969cc477dc41486ae4074e655d44274
Author: Ludovic Courtès <address@hidden>
Date:   Sat Mar 16 17:09:19 2019 +0100

    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.
---
 gnu/bootloader/extlinux.scm |  8 +++-----
 gnu/bootloader/grub.scm     | 16 ++++++++--------
 guix/scripts/system.scm     | 13 +++++++++++--
 3 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/gnu/bootloader/extlinux.scm b/gnu/bootloader/extlinux.scm
index 2bb711e..4010858 100644
--- a/gnu/bootloader/extlinux.scm
+++ b/gnu/bootloader/extlinux.scm
@@ -91,11 +91,9 @@ TIMEOUT ~a~%"
         (for-each (lambda (file)
                     (install-file file install-dir))
                   (find-files syslinux-dir "\\.c32$"))
-        (unless
-            (and (zero? (system* extlinux "--install" install-dir))
-                 (write-file-on-device
-                  (string-append syslinux-dir "/" #$mbr) 440 device 0))
-          (error "failed to install SYSLINUX")))))
+        (invoke/quiet extlinux "--install" install-dir)
+        (write-file-on-device (string-append syslinux-dir "/" #$mbr)
+                              440 device 0))))
 
 (define install-extlinux-mbr
   (install-extlinux "mbr.bin"))
diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index 51d5787..14aede7 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -369,10 +369,11 @@ submenu \"GNU system, old configurations...\" {~%")
         ;; root partition.
         (setenv "GRUB_ENABLE_CRYPTODISK" "y")
 
-        (unless (zero? (system* grub "--no-floppy" "--target=i386-pc"
-                                "--boot-directory" install-dir
-                                device))
-          (error "failed to install GRUB (BIOS)")))))
+        ;; 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
+                      device))))
 
 (define install-grub-efi
   #~(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
         ;; root partition.
         (setenv "GRUB_ENABLE_CRYPTODISK" "y")
-        (unless (zero? (system* grub-install "--boot-directory" install-dir
-                                "--bootloader-id=Guix"
-                                "--efi-directory" target-esp))
-          (error "failed to install GRUB (EFI)")))))
+        (invoke/quiet grub-install "--boot-directory" install-dir
+                      "--bootloader-id=Guix"
+                      "--efi-directory" target-esp))))
 
 
 
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index d67b9f8..b4bf668 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -808,8 +808,17 @@ and TARGET arguments."
                  #~(begin
                      (use-modules (gnu build bootloader)
                                   (guix build utils)
-                                  (ice-9 binary-ports))
-                     (#$installer #$bootloader #$device #$target)))))
+                                  (ice-9 binary-ports)
+                                  (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
                          #:key skip-safety-checks?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]