From 86783dc52d048418439019067a0a1afccd4829d1 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 2 Apr 2015 10:20:44 -0400 Subject: 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. --- src/Propellor/Bootstrap.hs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'src/Propellor/Bootstrap.hs') 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" -- cgit v1.3-2-g0d8e