From 2bb88b8c065113df820bd1b349edb11c6a4789f0 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 30 May 2021 16:07:13 -0700 Subject: add MOUNT:MOUNTED Signed-off-by: Sean Whitton --- src/package.lisp | 6 ++++-- src/property/mount.lisp | 11 +++++++++++ 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. -- cgit v1.2.3