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.
This commit is contained in:
parent
7feefb3b82
commit
7e6a42f215
1 changed files with 15 additions and 9 deletions
|
@ -423,18 +423,24 @@ fi~%"))))
|
||||||
|
|
||||||
(define install-grub
|
(define install-grub
|
||||||
#~(lambda (bootloader device mount-point)
|
#~(lambda (bootloader device mount-point)
|
||||||
;; Install GRUB on DEVICE which is mounted at MOUNT-POINT.
|
|
||||||
(let ((grub (string-append bootloader "/sbin/grub-install"))
|
(let ((grub (string-append bootloader "/sbin/grub-install"))
|
||||||
(install-dir (string-append mount-point "/boot")))
|
(install-dir (string-append mount-point "/boot")))
|
||||||
;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or
|
;; Install GRUB on DEVICE which is mounted at MOUNT-POINT. If DEVICE
|
||||||
;; root partition.
|
;; 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")
|
(setenv "GRUB_ENABLE_CRYPTODISK" "y")
|
||||||
|
|
||||||
;; Hide potentially confusing messages from the user, such as
|
;; Hide potentially confusing messages from the user, such as
|
||||||
;; "Installing for i386-pc platform."
|
;; "Installing for i386-pc platform."
|
||||||
(invoke/quiet grub "--no-floppy" "--target=i386-pc"
|
(invoke/quiet grub "--no-floppy" "--target=i386-pc"
|
||||||
"--boot-directory" install-dir
|
"--boot-directory" install-dir
|
||||||
device))))
|
device))
|
||||||
|
;; When creating a disk-image, only install GRUB modules.
|
||||||
|
(copy-recursively (string-append bootloader "/lib/")
|
||||||
|
install-dir)))))
|
||||||
|
|
||||||
(define install-grub-disk-image
|
(define install-grub-disk-image
|
||||||
#~(lambda (bootloader root-index image)
|
#~(lambda (bootloader root-index image)
|
||||||
|
|
Reference in a new issue