Group properties
Signed-off-by: Félix Sipma <felix.sipma@no-log.org>
This commit is contained in:
parent
69eace8e9a
commit
6aa21366d5
|
@ -83,6 +83,7 @@ Library
|
|||
Propellor.Property.Firewall
|
||||
Propellor.Property.Git
|
||||
Propellor.Property.Gpg
|
||||
Propellor.Property.Group
|
||||
Propellor.Property.Grub
|
||||
Propellor.Property.Network
|
||||
Propellor.Property.Nginx
|
||||
|
|
|
@ -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']
|
Loading…
Reference in New Issue