From 6aa21366d57679f82fbaf96a90f93d2d1ac7f223 Mon Sep 17 00:00:00 2001 From: Félix Sipma Date: Sun, 23 Nov 2014 18:33:26 +0100 Subject: Group properties Signed-off-by: Félix Sipma --- src/Propellor/Property/Group.hs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/Propellor/Property/Group.hs (limited to 'src/Propellor/Property/Group.hs') diff --git a/src/Propellor/Property/Group.hs b/src/Propellor/Property/Group.hs new file mode 100644 index 00000000..f03510cf --- /dev/null +++ b/src/Propellor/Property/Group.hs @@ -0,0 +1,14 @@ +module Propellor.Property.Group where + +import Propellor + +type GID = Int + +exists :: GroupName -> Maybe GID -> Property +exists group' mgid = check test (cmdProperty "addgroup" $ args mgid) + `describe` unwords ["group", group'] + where + groupFile = "/etc/group" + test = not <$> elem group' <$> words <$> readProcess "cut" ["-d:", "-f1", groupFile] + args Nothing = [group'] + args (Just gid) = ["--gid", show gid, group'] -- cgit v1.2.3