summaryrefslogtreecommitdiff
path: root/src/Propellor/Bootstrap.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Propellor/Bootstrap.hs')
-rw-r--r--src/Propellor/Bootstrap.hs21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/Propellor/Bootstrap.hs b/src/Propellor/Bootstrap.hs
index 214f65d5..b0b4e58a 100644
--- a/src/Propellor/Bootstrap.hs
+++ b/src/Propellor/Bootstrap.hs
@@ -1,5 +1,6 @@
module Propellor.Bootstrap (
bootstrapPropellorCommand,
+ checkBinaryCommand,
installGitCommand,
buildPropellor,
) where
@@ -12,17 +13,27 @@ import Data.List
type ShellCommand = String
--- Shell command line to build propellor, used when bootstrapping on a new
--- host. Should be run inside the propellor config dir, and will install
--- all necessary build dependencies.
+-- Shell command line to ensure propellor is bootstrapped and ready to run.
+-- Should be run inside the propellor config dir, and will install
+-- all necessary build dependencies and build propellor.
bootstrapPropellorCommand :: ShellCommand
-bootstrapPropellorCommand = "if ! test -x ./propellor; then " ++ go ++ "; fi"
+bootstrapPropellorCommand = "if ! test -x ./propellor; then " ++ go ++ "; fi;" ++ checkBinaryCommand
where
- go = intercalate " && "
+ go = intercalate " && "
[ depsCommand
, buildCommand
]
+-- Use propellor --check to detect if the local propellor binary has
+-- stopped working (eg due to library changes), and must be rebuilt.
+checkBinaryCommand :: ShellCommand
+checkBinaryCommand = "if test -x ./propellor && ! ./propellor --check; then " ++ go ++ "; fi"
+ where
+ go = intercalate " && "
+ [ "cabal clean"
+ , buildCommand
+ ]
+
buildCommand :: ShellCommand
buildCommand = intercalate " && "
[ "cabal configure"