aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/connection/chroot.lisp13
-rw-r--r--src/connection/fork.lisp4
-rw-r--r--src/package.lisp5
-rw-r--r--src/property/disk.lisp8
-rw-r--r--src/util.lisp4
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