diff options
author | Mathieu Othacehe <othacehe@gnu.org> | 2020-05-23 19:09:38 +0200 |
---|---|---|
committer | Mathieu Othacehe <othacehe@gnu.org> | 2020-05-29 08:40:00 +0200 |
commit | 7e6a42f215726b6ea5b1a2a8b8bc80481f7ebcd9 (patch) | |
tree | 8ca1f254c15d61272de5dbdabbeccba426865496 | |
parent | 7feefb3b82186be382725ac2d6b7e9f8953e4a83 (diff) |
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.
-rw-r--r-- | gnu/bootloader/grub.scm | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index 57deaba912..23c7a82084 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, then we populate the disk-image rooted at MOUNT-POINT. + (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) |