summaryrefslogtreecommitdiff
path: root/Propellor/CmdLine.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Propellor/CmdLine.hs')
-rw-r--r--Propellor/CmdLine.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/Propellor/CmdLine.hs b/Propellor/CmdLine.hs
index e43cf0aa..05df86bf 100644
--- a/Propellor/CmdLine.hs
+++ b/Propellor/CmdLine.hs
@@ -5,6 +5,7 @@ import Data.List
import System.Exit
import Propellor
+import Propellor.SimpleSh
import Utility.FileMode
import Utility.SafeCommand
@@ -15,6 +16,7 @@ data CmdLine
| Set HostName PrivDataField
| AddKey String
| Continue CmdLine
+ | SimpleSh FilePath
deriving (Read, Show, Eq)
usage :: IO a
@@ -39,9 +41,10 @@ processCmdLine = go =<< getArgs
go ("--set":h:f:[]) = case readish f of
Just pf -> return $ Set h pf
Nothing -> errorMessage $ "Unknown privdata field " ++ f
- go ("--continue":s:[]) =case readish s of
+ go ("--continue":s:[]) = case readish s of
Just cmdline -> return $ Continue cmdline
Nothing -> errorMessage "--continue serialization failure"
+ go ("--simplesh":f:[]) = return $ SimpleSh f
go (h:[]) = return $ Run h
go [] = do
s <- takeWhile (/= '\n') <$> readProcess "hostname" ["-f"]
@@ -56,6 +59,7 @@ defaultMain getprops = go True =<< processCmdLine
go _ (Continue cmdline) = go False cmdline
go _ (Set host field) = setPrivData host field
go _ (AddKey keyid) = addKey keyid
+ go _ (SimpleSh f) = simpleSh f
go True cmdline@(Spin _) = buildFirst cmdline $ go False cmdline
go True cmdline = updateFirst cmdline $ go False cmdline
go False (Spin host) = withprops host $ const $ spin host