aboutsummaryrefslogtreecommitdiff
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
parente83214c6752048392305644f5399c4c0621c690f (diff)
downloadconsfigurator-2bb88b8c065113df820bd1b349edb11c6a4789f0.tar.gz
add MOUNT:MOUNTED
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r--src/package.lisp6
-rw-r--r--src/property/mount.lisp11
2 files changed, 15 insertions, 2 deletions
diff --git a/src/package.lisp b/src/package.lisp
index fc0cda3..3da19e5 100644
--- a/src/package.lisp
+++ b/src/package.lisp
@@ -318,8 +318,10 @@
(defpackage :consfigurator.property.mount
(:use #:cl #:alexandria #:consfigurator)
(:local-nicknames (#:os #:consfigurator.property.os)
- (#:cmd #:consfigurator.property.cmd))
- (:export #:unmounted-below
+ (#:cmd #:consfigurator.property.cmd)
+ (#:file #:consfigurator.property.file))
+ (:export #:mounted
+ #:unmounted-below
#:unmounted-below-and-removed))
(defpackage :consfigurator.property.service
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.