diff options
| author | Joey Hess <joey@kitenet.net> | 2014-11-23 14:41:09 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-11-23 14:41:09 -0400 |
| commit | ac41f8b07b45b1855b1c10665757691a56b08353 (patch) | |
| tree | d446f81a4068ca594abd881c2b055ad2f8662a12 /src/Propellor/Property/Group.hs | |
| parent | 1b34f23414b574105ddfdf36fbeb86aa115a0e2e (diff) | |
| parent | 3c952a0de9d228eafe6e208007be7d2e018d68b8 (diff) | |
Merge branch 'joeyconfig'
Diffstat (limited to 'src/Propellor/Property/Group.hs')
| -rw-r--r-- | src/Propellor/Property/Group.hs | 14 |
1 files changed, 14 insertions, 0 deletions
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'] |
