aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-07-02 10:42:55 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-07-06 21:19:39 -0700
commite0672a93ed2e4899dd3ab40e247edac82827e2bc (patch)
tree60a46955885e9e4477e7c20eca769dc15e3bb5eb /src
parenta4cb8a892183462b0713580a5e2134c3f3d1d95d (diff)
downloadconsfigurator-e0672a93ed2e4899dd3ab40e247edac82827e2bc.tar.gz
factor out MOUNT:*{STANDARD-LINUX,LINUX-EFIVARS}-VFS*
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src')
-rw-r--r--src/connection/chroot.lisp14
-rw-r--r--src/package.lisp5
-rw-r--r--src/property/mount.lisp15
3 files changed, 21 insertions, 13 deletions
diff --git a/src/connection/chroot.lisp b/src/connection/chroot.lisp
index 2895641..31ce5cb 100644
--- a/src/connection/chroot.lisp
+++ b/src/connection/chroot.lisp
@@ -58,15 +58,6 @@ should be the mount point, without the chroot's root prefixed.")
(dolist (mount (chroot-mounts connection))
(mrun "umount" mount)))
-(defparameter *standard-chroot-mounts* '(
-("-t" "proc" "-o" "nosuid,noexec,nodev" "proc" "/proc")
-("-t" "sysfs" "-o" "nosuid,noexec,nodev,ro" "sys" "/sys")
-("-t" "devtmpfs" "-o" "mode=0755,nosuid" "udev" "/dev")
-("-t" "devpts" "-o" "mode=0620,gid=5,nosuid,noexec" "devpts" "/dev/pts")
-("-t" "tmpfs" "-o" "mode=1777,nosuid,nodev" "shm" "/dev/shm")
-("-t" "tmpfs" "-o" "mode=1777,strictatime,nodev,nosuid" "tmp" "/tmp")
-("--bind" "/run" "/run")))
-
(defmethod initialize-instance :after ((connection chroot-connection) &key)
(when (string= "Linux" (stripln (run "uname")))
(with-slots (into) connection
@@ -76,11 +67,10 @@ should be the mount point, without the chroot's root prefixed.")
(chroot-mount connection "--bind" into "/"))
;; Now set up the usual bind mounts. Help here from arch-chroot(8).
(mount:assert-devtmpfs-udev-/dev)
- (dolist (mount *standard-chroot-mounts*)
+ (dolist (mount mount:*standard-linux-vfs*)
(apply #'chroot-mount connection mount))
(when (remote-exists-p "/sys/firmware/efi/efivars")
- (chroot-mount connection "-t" "efivarfs" "-o" "nosuid,noexec,nodev"
- "efivarfs" "/sys/firmware/efi/efivars")))))
+ (apply #'chroot-mount connection mount:*linux-efivars-vfs*)))))
(defmethod propagate-connattr
((type (eql :opened-volumes)) connattr (connection chroot-connection))
diff --git a/src/package.lisp b/src/package.lisp
index 11ecb73..b2381e4 100644
--- a/src/package.lisp
+++ b/src/package.lisp
@@ -355,6 +355,8 @@
#:unmounted-below
#:unmounted-below-and-removed
#:all-mounts
+ #:*standard-linux-vfs*
+ #:*linux-efivars-vfs*
#:assert-devtmpfs-udev-/dev))
(defpackage :consfigurator.property.service
@@ -815,7 +817,8 @@
#:consfigurator.connection.rehome
#:consfigurator.connection.shell-wrap
#:cffi)
- (:local-nicknames (#:disk #:consfigurator.property.disk)))
+ (:local-nicknames (#:disk #:consfigurator.property.disk)
+ (#:mount #:consfigurator.property.mount)))
(defpackage :consfigurator.connection.setuid
(:use #:cl
diff --git a/src/property/mount.lisp b/src/property/mount.lisp
index aa01050..a48a83b 100644
--- a/src/property/mount.lisp
+++ b/src/property/mount.lisp
@@ -93,6 +93,21 @@ Uses findmnt(8), so Linux-specific."
;;;; Utilities for :LISP properties
+(defparameter *standard-linux-vfs* '(
+("-t" "proc" "-o" "nosuid,noexec,nodev" "proc" "/proc")
+("-t" "sysfs" "-o" "nosuid,noexec,nodev,ro" "sys" "/sys")
+("-t" "devtmpfs" "-o" "mode=0755,nosuid" "udev" "/dev")
+("-t" "devpts" "-o" "mode=0620,gid=5,nosuid,noexec" "devpts" "/dev/pts")
+("-t" "tmpfs" "-o" "mode=1777,nosuid,nodev" "shm" "/dev/shm")
+("-t" "tmpfs" "-o" "mode=1777,strictatime,nodev,nosuid" "tmp" "/tmp")
+("--bind" "/run" "/run")))
+
+(defparameter *linux-efivars-vfs*
+ '("-t" "efivarfs" "-o" "nosuid,noexec,nodev" "efivarfs"
+ "/sys/firmware/efi/efivars")
+ "Arguments to mount(8) to mount the UEFI NVRAM.
+After mounting /sys, mount this when /sys/firmware/efi/efivars exists.")
+
(defun assert-devtmpfs-udev-/dev ()
"On a system with the Linux kernel, assert that /dev has fstype devtmpfs."
(unless (and (zerop (mrun :for-exit "mountpoint" "-q" "/dev"))