aboutsummaryrefslogtreecommitdiff
path: root/src/property/installer.lisp
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-07-09 20:33:25 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-07-10 21:37:44 -0700
commit3f989153c3bb0b40677bd59974d9871551f36f90 (patch)
tree04394c0796b6a7789767ab076ead6d794875e84a /src/property/installer.lisp
parentb2f8efedca871544731b2873e6e57e296733278b (diff)
downloadconsfigurator-3f989153c3bb0b40677bd59974d9871551f36f90.tar.gz
INSTALLER:CLEANLY-INSTALLED-ONCE: handle EFI system partition
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/property/installer.lisp')
-rw-r--r--src/property/installer.lisp25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/property/installer.lisp b/src/property/installer.lisp
index 6b7b396..9acf967 100644
--- a/src/property/installer.lisp
+++ b/src/property/installer.lisp
@@ -169,11 +169,25 @@ install a package providing /usr/sbin/grub-install, but it won't execute it."
;; etc.; avoid upsetting those.
#P"/run/" #P"/tmp/"
;; Makes sense to keep /proc until we replace the running init.
- #P"/proc/")))
+ #P"/proc/"))
+ efi-system-partition-mount-args)
(flet ((preservedp (pathname)
(member pathname preserved-directories :test #'pathname-equal)))
(mount:assert-devtmpfs-udev-/dev)
+ ;; If there's an EFI system partition, we need to store knowledge of
+ ;; how to mount it so that we can restore the mount after doing the
+ ;; moves, so that installing an EFI bootloader is possible. The user
+ ;; is responsible for adding an entry for the EFI system partition to
+ ;; the new system's fstab, but we are responsible for restoring
+ ;; knowledge of the partition to the kernel's mount table.
+ (when (zerop (mrun :for-exit "mountpoint" "-q" "/boot/efi"))
+ (destructuring-bind (type source options)
+ (words (stripln (run "findmnt" "-nro" "FSTYPE,SOURCE,OPTIONS"
+ "/boot/efi")))
+ (setq efi-system-partition-mount-args
+ `("-t" ,type "-o" ,options ,source "/boot/efi"))))
+
;; We are not killing any processes, so lazily unmount everything
;; before trying to perform any renames. (Present structure of this
;; loop assumes that each member of PRESERVED-DIRECTORIES is directly
@@ -228,14 +242,17 @@ install a package providing /usr/sbin/grub-install, but it won't execute it."
#P"/root/.cache/consfigurator/"))))
(posix-login-environment "root" "/root")
- ;; Remount virtual filesystems that other properties we will apply
- ;; might require (esp. relevant for installing bootloaders).
+ ;; Remount (mainly virtual) filesystems that other properties we will
+ ;; apply might require (esp. relevant for installing bootloaders).
(dolist (mount mount:*standard-linux-vfs*)
(unless (preservedp (ensure-directory-pathname (lastcar mount)))
(apply #'system "mount" mount)))
(when (and (not (preservedp #P"/sys/"))
(directory-exists-p "/sys/firmware/efi/efivars"))
- (apply #'mrun "mount" mount:*linux-efivars-vfs*))))))
+ (apply #'mrun "mount" mount:*linux-efivars-vfs*))
+ (when efi-system-partition-mount-args
+ (ensure-directories-exist #P"/boot/efi/")
+ (apply #'mrun "mount" efi-system-partition-mount-args))))))
(defproplist cleanly-installed-once :lisp
(&optional options (original-os '(os:linux :amd64))