summaryrefslogtreecommitdiff
path: root/src/Propellor/Bootstrap.hs
diff options
context:
space:
mode:
authorJoey Hess2015-04-02 10:20:44 -0400
committerJoey Hess2015-04-02 10:20:44 -0400
commit86783dc52d048418439019067a0a1afccd4829d1 (patch)
tree392e55d1b1abecf0dab5e4b0ecec3a9359d0f6e0 /src/Propellor/Bootstrap.hs
parent015b249c6672527dce31a61610358ccbb46f3b46 (diff)
Make propellor resistent to changes to shared libraries, such as libffi
* Make propellor resistent to changes to shared libraries, such as libffi, which might render the propellor binary unable to run. This is dealt with by checking the binary both when running propellor on a remote host, and by Cron.runPropellor. If the binary doesn't work, it will be rebuilt. * Note that since a new switch had to be added to allow testing the binary, upgrading to this version will cause a rebuild from scratch of propellor.
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"