From e6d24b49b87de312776bee71a2a6f009f7f397a9 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 1 Apr 2014 16:58:11 -0400 Subject: various improvements --- Propellor/Property/Cmd.hs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Propellor/Property/Cmd.hs') 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 -- cgit v1.2.3