diff options
| author | Joey Hess <joey@kitenet.net> | 2014-03-29 23:10:52 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-03-29 23:16:43 -0400 |
| commit | d9af8bac5eb7836a3c90e37e870fd73d30b841fd (patch) | |
| tree | 40443efd384415172cf393571fe3f1651ea57423 /Property/User.hs | |
initial check-in
too young to have a name
Diffstat (limited to 'Property/User.hs')
| -rw-r--r-- | Property/User.hs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Property/User.hs b/Property/User.hs new file mode 100644 index 00000000..f43c9b20 --- /dev/null +++ b/Property/User.hs @@ -0,0 +1,22 @@ +module Property.User where + +import Data.List +import System.Posix +import Control.Applicative +import Data.Maybe + +import Property +import Utility.SafeCommand +import Utility.Exception + +type UserName = String + +nonsystem :: UserName -> Property +nonsystem user = check (isNothing <$> homedir user) $ cmdProperty "adduser" + [ Param "--disabled-password" + , Param "--gecos", Param "" + , Param user + ] + +homedir :: UserName -> IO (Maybe FilePath) +homedir user = catchMaybeIO $ homeDirectory <$> getUserEntryForName user |
