diff options
-rw-r--r-- | src/package.lisp | 1 | ||||
-rw-r--r-- | src/property/user.lisp | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/package.lisp b/src/package.lisp index a8b298e..c65b04b 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -558,6 +558,7 @@ (#:os #:consfigurator.property.os)) (:export #:has-account #:has-account-with-uid + #:group-exists #:has-groups #:has-desktop-groups #:has-login-shell 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." |