aboutsummaryrefslogtreecommitdiff
path: root/src/property/user.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'src/property/user.lisp')
-rw-r--r--src/property/user.lisp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/property/user.lisp b/src/property/user.lisp
index 1dd9f1d..67190df 100644
--- a/src/property/user.lisp
+++ b/src/property/user.lisp
@@ -52,6 +52,16 @@ that group, and ~USERNAME and its contents are owned by UID:GID."
(has-account username)
(%has-uid-gid username uid gid))
+(defprop group-exists :posix (groupname)
+ "Ensure there is a group GROUPNAME.
+Note that this uses getent(1) and so is not strictly POSIX-compatible."
+ (:desc #?"Group ${groupname} exists")
+ (:check
+ (zerop (mrun :for-exit "getent" "group" groupname)))
+ (:apply
+ (assert-remote-euid-root)
+ (mrun "groupadd" groupname)))
+
(defprop has-groups :posix
(username &rest groups &aux (groups* (format nil "~{~A~^,~}" groups)))
"Ensure that USERNAME is a member of secondary groups GROUPS."