module Propellor.Property.Group where import Propellor.Base import Propellor.Property.User (hasGroup) type GID = Int exists :: Group -> Maybe GID -> Property UnixLike exists :: Group -> Maybe GID -> Property UnixLike exists (Group String group') Maybe GID mgid = forall (p :: * -> *) i (m :: * -> *). (Checkable p i, LiftPropellor m) => m Bool -> p i -> Property i check IO Bool test (String -> [String] -> UncheckedProperty UnixLike cmdProperty String "addgroup" (forall {a}. Show a => Maybe a -> [String] args Maybe GID mgid)) forall p. IsProp p => p -> String -> p `describe` [String] -> String unwords [String "group", String group'] where groupFile :: String groupFile = String "/etc/group" test :: IO Bool test = Bool -> Bool not forall b c a. (b -> c) -> (a -> b) -> a -> c . forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool elem String group' forall b c a. (b -> c) -> (a -> b) -> a -> c . String -> [String] words forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> String -> [String] -> IO String readProcess String "cut" [String "-d:", String "-f1", String groupFile] args :: Maybe a -> [String] args Maybe a Nothing = [String group'] args (Just a gid) = [String "--gid", forall a. Show a => a -> String show a gid, String group'] hasUser :: Group -> User -> Property DebianLike hasUser :: Group -> User -> Property DebianLike hasUser = forall a b c. (a -> b -> c) -> b -> a -> c flip User -> Group -> Property DebianLike hasGroup