diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-04-30 16:55:08 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-04-30 17:56:41 -0700 |
commit | 0ad4421ff9ace9fb9953ee5ec0c2052ce37f36ba (patch) | |
tree | fb64d8b205761ad10a9e3dc4204a3cb0acd17101 | |
parent | 68d7fdae8e83847fb024bf8103dc0e71ffa29b24 (diff) | |
download | consfigurator-0ad4421ff9ace9fb9953ee5ec0c2052ce37f36ba.tar.gz |
reflect *MOUNT-BELOW* in OPENED-FILESYSTEM values
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r-- | src/connection/chroot.lisp | 13 | ||||
-rw-r--r-- | src/connection/fork.lisp | 4 | ||||
-rw-r--r-- | src/package.lisp | 5 | ||||
-rw-r--r-- | src/property/disk.lisp | 8 | ||||
-rw-r--r-- | src/util.lisp | 4 |
5 files changed, 26 insertions, 8 deletions
diff --git a/src/connection/chroot.lisp b/src/connection/chroot.lisp index 802d3ce..21d0cc2 100644 --- a/src/connection/chroot.lisp +++ b/src/connection/chroot.lisp @@ -81,6 +81,19 @@ should be the mount point, without the chroot's root prefixed.") (chroot-mount connection "-t" "efivarfs" "-o" "nosuid,noexec,nodev" "efivarfs" "/sys/firmware/efi/efivars"))))) +(defmethod propagate-connattr + ((type (eql :opened-volumes)) connattr (connection chroot-connection)) + (with-slots (into) connection + (loop for volume in connattr + when (and (subtypep (type-of volume) 'disk:filesystem) + (slot-boundp volume 'disk:mount-point) + (subpathp (disk:mount-point volume) into)) + collect (let ((copy (disk:copy-volume-and-contents volume))) + (setf (disk:mount-point copy) + (in-chroot-pathname (disk:mount-point copy) into)) + copy) + else collect volume))) + ;;;; :CHROOT.FORK diff --git a/src/connection/fork.lisp b/src/connection/fork.lisp index 0bc139c..072145c 100644 --- a/src/connection/fork.lisp +++ b/src/connection/fork.lisp @@ -111,7 +111,3 @@ for example, such that we don't see it." (error "Fork connection child failed, exit code ~D" exit-status)) (values nil (if (zerop status) :no-change nil)))))))))) - -(defmethod propagate-connattr - ((type (eql :opened-volumes)) connattr (connection fork-connection)) - connattr) diff --git a/src/package.lisp b/src/package.lisp index 104b13d..2920958 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -68,6 +68,7 @@ #:quote-nonselfeval #:define-print-object-for-structlike #:chroot-pathname + #:in-chroot-pathname #:*consfigurator-debug-level* #:with-indented-inform @@ -371,6 +372,7 @@ #:volume-contents #:volume-size #:subvolumes-of-type + #:copy-volume-and-contents #:physical-disk #:disk-image @@ -506,7 +508,8 @@ #:consfigurator.connection.fork #:consfigurator.connection.rehome #:consfigurator.connection.shell-wrap - #:cffi)) + #:cffi) + (:local-nicknames (#:disk #:consfigurator.property.disk))) (defpackage :consfigurator.connection.setuid (:use #:cl diff --git a/src/property/disk.lisp b/src/property/disk.lisp index f6a5615..0cac9d9 100644 --- a/src/property/disk.lisp +++ b/src/property/disk.lisp @@ -385,10 +385,12 @@ possible. Ignored if VOLUME-SIZE is also bound.")) (defclass-opened-volume mounted-filesystem (filesystem)) (defmethod open-volume ((volume filesystem) (file pathname)) - (let ((mount-point (chroot-pathname (mount-point volume) *mount-below*))) + (let* ((mount-point (chroot-pathname (mount-point volume) *mount-below*)) + (opened-volume (make-opened-volume volume file))) + (setf (mount-point opened-volume) mount-point) (file:directory-exists mount-point) - (mrun "mount" file mount-point)) - (make-opened-volume volume file)) + (mrun "mount" file mount-point) + opened-volume)) (defmethod close-volume ((volume mounted-filesystem)) (mrun "umount" (device-file volume))) diff --git a/src/util.lisp b/src/util.lisp index 82a7f55..a109720 100644 --- a/src/util.lisp +++ b/src/util.lisp @@ -178,6 +178,10 @@ one-dimensional collections of values." (merge-pathnames (enough-pathname pathname #P"/") (ensure-directory-pathname chroot))) +(defun in-chroot-pathname (pathname chroot) + (ensure-pathname (enough-pathname pathname chroot) + :ensure-absolute t :defaults #P"/")) + ;;;; Progress & debug printing |