From e170189b23724d8f8b610d5dcb80c35a16f5fd0a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 31 Mar 2014 18:53:27 -0400 Subject: [PATCH] propellor spin --- Propellor/CmdLine.hs | 21 +++++++++++++++++--- privdata/orca.kitenet.net.gpg | 36 +++++++++++++++++------------------ 2 files changed, 36 insertions(+), 21 deletions(-) diff --git a/Propellor/CmdLine.hs b/Propellor/CmdLine.hs index 08d9524..7461a82 100644 --- a/Propellor/CmdLine.hs +++ b/Propellor/CmdLine.hs @@ -56,10 +56,11 @@ defaultMain getprops = go True =<< processCmdLine go _ (Continue cmdline) = go False cmdline go _ (Set host field) = setPrivData host field go _ (AddKey keyid) = addKey keyid - go _ (Spin host) = withprops host $ const $ spin host + go True cmdline@(Spin _) = buildFirst cmdline $ go False cmdline go True cmdline = updateFirst cmdline $ go False cmdline - go _ (Run host) = withprops host $ ensureProperties - go _ (Boot host) = withprops host $ boot + go False (Spin host) = withprops host $ const $ spin host + go False (Run host) = withprops host $ ensureProperties + go False (Boot host) = withprops host $ boot withprops host a = maybe (unknownhost host) a (getprops host) @@ -69,6 +70,20 @@ unknownhost h = errorMessage $ unwords , "(perhaps you should specify the real hostname on the command line?)" ] +buildFirst :: CmdLine -> IO () -> IO () +buildFirst cmdline next = do + oldtime <- getmtime + ifM (actionMessage "Rebuilding propellor" $ boolSystem "make" [Param "build"]) + ( do + newtime <- getmtime + if newtime == oldtime + then next + else void $ boolSystem "./propellor" [Param "--continue", Param (show cmdline)] + , errorMessage "Propellor build failed!" + ) + where + getmtime = catchMaybeIO $ getModificationTime "propellor" + updateFirst :: CmdLine -> IO () -> IO () updateFirst cmdline next = do branchref <- takeWhile (/= '\n') diff --git a/privdata/orca.kitenet.net.gpg b/privdata/orca.kitenet.net.gpg index e164c98..0bc59ef 100644 --- a/privdata/orca.kitenet.net.gpg +++ b/privdata/orca.kitenet.net.gpg @@ -1,22 +1,22 @@ -----BEGIN PGP MESSAGE----- Version: GnuPG v1 -hQIMA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