aboutsummaryrefslogtreecommitdiff
path: root/src/property/mount.lisp
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-05-30 16:07:13 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-05-30 16:11:08 -0700
commit2bb88b8c065113df820bd1b349edb11c6a4789f0 (patch)
tree2869fcf0f3f87a11450299450890b83ad9da2fb2 /src/property/mount.lisp
parente83214c6752048392305644f5399c4c0621c690f (diff)
downloadconsfigurator-2bb88b8c065113df820bd1b349edb11c6a4789f0.tar.gz
add MOUNT:MOUNTED
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/property/mount.lisp')
-rw-r--r--src/property/mount.lisp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/property/mount.lisp b/src/property/mount.lisp
index 72eb8d7..53d1b2e 100644
--- a/src/property/mount.lisp
+++ b/src/property/mount.lisp
@@ -18,6 +18,17 @@
(in-package :consfigurator.property.mount)
(named-readtables:in-readtable :consfigurator)
+(defprop mounted :posix (&key target)
+ "Ensures that TARGET, a mount point configured in /etc/fstab, is mounted.
+Mainly useful as a dependency of properties which might do the wrong thing if
+the mount is not actually active."
+ (:desc #?"${target} mounted")
+ (:hostattrs (os:required 'os:linux))
+ (:check (zerop (mrun :for-exit "findmnt" target)))
+ (:apply (assert-euid-root)
+ (file:directory-exists target)
+ (mrun "mount" target)))
+
(defprop unmounted-below :posix (dir)
"Unmount anything mounted at or below DIR.