summaryrefslogtreecommitdiff
path: root/Propellor/Property/Cmd.hs
diff options
context:
space:
mode:
authorJoey Hess2014-04-01 16:58:11 -0400
committerJoey Hess2014-04-01 16:58:11 -0400
commite6d24b49b87de312776bee71a2a6f009f7f397a9 (patch)
treeceba3045f23ee1d3cf36bfe8e8ffa9cb090b9e54 /Propellor/Property/Cmd.hs
parent6a82cdc41c89cc249da4d941a32920ebfd14cb92 (diff)
various improvements
Diffstat (limited to 'Propellor/Property/Cmd.hs')
-rw-r--r--Propellor/Property/Cmd.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/Propellor/Property/Cmd.hs b/Propellor/Property/Cmd.hs
index b1c9435a..1f668daf 100644
--- a/Propellor/Property/Cmd.hs
+++ b/Propellor/Property/Cmd.hs
@@ -2,6 +2,7 @@ module Propellor.Property.Cmd (
cmdProperty,
cmdProperty',
scriptProperty,
+ userScriptProperty,
serviceRunning,
) where
@@ -39,6 +40,13 @@ scriptProperty script = cmdProperty "sh" ["-c", shellcmd]
where
shellcmd = intercalate " ; " ("set -e" : script)
+-- | A property that can satisfied by running a series of shell commands,
+-- as user (staring in their home directory).
+userScriptProperty :: UserName -> [String] -> Property
+userScriptProperty user script = cmdProperty "su" ["-c", shellcmd, user]
+ where
+ shellcmd = intercalate " ; " ("set -e" : "cd" : script)
+
-- | Ensures that a service is running.
--
-- Note that due to the general poor state of init scripts, the best