summaryrefslogtreecommitdiff
path: root/Propellor/CmdLine.hs
diff options
context:
space:
mode:
authorJoey Hess2014-04-01 02:37:48 -0400
committerJoey Hess2014-04-01 02:37:48 -0400
commit25c4d185037bcf0c7aa42a11dc0295914c128ddc (patch)
treed59d8ebb431cbda93af9998ddaf55fb7e12cd1ad /Propellor/CmdLine.hs
parent90f86b8b2bb7f0a3c834387827c9ec2e1876f342 (diff)
simple socket server, will hopefully work with docker
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