From 25c4d185037bcf0c7aa42a11dc0295914c128ddc Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 1 Apr 2014 02:37:48 -0400 Subject: simple socket server, will hopefully work with docker --- Propellor/CmdLine.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Propellor/CmdLine.hs') 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 -- cgit v1.2.3