guix-commits
[Top][All Lists]
Advanced

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

10/35: bootloader: grub: Do not run grub-install when creating a disk-im


From: guix-commits
Subject: 10/35: bootloader: grub: Do not run grub-install when creating a disk-image.
Date: Thu, 28 May 2020 13:03:30 -0400 (EDT)

janneke pushed a commit to branch wip-hurd-vm
in repository guix.

commit 1231aec738b4fc235ad67f362c9e6fb5564ad8ea
Author: Mathieu Othacehe <othacehe@gnu.org>
AuthorDate: Sat May 23 19:09:38 2020 +0200

    bootloader: grub: Do not run grub-install when creating a disk-image.
    
    * gnu/bootloader/grub.scm (install-grub): When creating a disk-image,
    grub-install will fail because it lacks root permissions. In that case, do 
not
    run grub-install and only copy Grub modules to the /boot directory.
---
 gnu/bootloader/grub.scm | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index 74dc004..29bec92 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -423,18 +423,24 @@ fi~%"))))
 
 (define install-grub
   #~(lambda (bootloader device mount-point)
-      ;; Install GRUB on DEVICE which is mounted at MOUNT-POINT.
       (let ((grub (string-append bootloader "/sbin/grub-install"))
             (install-dir (string-append mount-point "/boot")))
-        ;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or
-        ;; root partition.
-        (setenv "GRUB_ENABLE_CRYPTODISK" "y")
-
-        ;; 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))))
+        ;; Install GRUB on DEVICE which is mounted at MOUNT-POINT. If device
+        ;; is #f we are creating a disk-image.
+        (if device
+            (begin
+              ;; Tell 'grub-install' that there might be a LUKS-encrypted
+              ;; /boot or root partition.
+              (setenv "GRUB_ENABLE_CRYPTODISK" "y")
+
+              ;; 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))
+            ;; When creating a disk-image, only install Grub modules.
+            (copy-recursively (string-append bootloader "/lib/")
+                              install-dir)))))
 
 (define install-grub-disk-image
   #~(lambda (bootloader root-index image)



reply via email to

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