diff options
| author | Joey Hess <joeyh@joeyh.name> | 2015-02-28 12:50:28 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2015-02-28 12:51:16 -0400 |
| commit | e26c232d154eb1a6b6eca631414ed7526993f88c (patch) | |
| tree | 9abcbb57226f4d31a5e4ab9e7b8e36e88055dbac /src/Propellor/Bootstrap.hs | |
| parent | dc03e317b40d640e6501be0fce3e32bc29699fbb (diff) | |
avoid using the makefile when bootstrapping with --spin
Diffstat (limited to 'src/Propellor/Bootstrap.hs')
| -rw-r--r-- | src/Propellor/Bootstrap.hs | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/src/Propellor/Bootstrap.hs b/src/Propellor/Bootstrap.hs index 7ad4bb1f..0b3072b2 100644 --- a/src/Propellor/Bootstrap.hs +++ b/src/Propellor/Bootstrap.hs @@ -1,11 +1,62 @@ module Propellor.Bootstrap ( - buildPropellor + bootstrapPropellorCommand, + installGitCommand, + buildPropellor, ) where import Propellor import Utility.SafeCommand import System.Posix.Files +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 source tree, and will install +-- all necessary build dependencies. +bootstrapPropellorCommand :: ShellCommand +bootstrapPropellorCommand = "if ! test -x ./propellor; then " ++ go ++ "; fi" + where + go = intercalate " && " + [ depsCommand + , buildCommand + ] + +buildCommand :: ShellCommand +buildCommand = intercalate " && " + [ "cabal configure" + , "cabal build" + , "ln -sf dist/build/propellor-config/propellor-config propellor" + ] + +depsCommand :: ShellCommand +depsCommand = "(" ++ aptinstall debdeps ++ " || (apt-get update && " ++ aptinstall debdeps ++ ")) || true;" + ++ "(" ++ aptinstall ["libghc-async-dev"] ++ " || (cabal update; cabal install async)) || true" + where + aptinstall ps = "apt-get --no-upgrade --no-install-recommends -y install " ++ unwords ps + + -- This is the same build deps listed in debian/control. + debdeps = + [ "gnupg" + , "ghc" + , "cabal-install" + -- async is not available in debian stable + -- , "libghc-async-dev" + , "libghc-missingh-dev" + , "libghc-hslogger-dev" + , "libghc-unix-compat-dev" + , "libghc-ansi-terminal-dev" + , "libghc-ifelse-dev" + , "libghc-network-dev" + , "libghc-quickcheck2-dev" + , "libghc-mtl-dev" + , "libghc-monadcatchio-transformers-dev" + ] + + +installGitCommand :: ShellCommand +installGitCommand = "if ! git --version >/dev/null; then apt-get update && apt-get --no-install-recommends --no-upgrade -y install git; fi" buildPropellor :: IO () buildPropellor = unlessM (actionMessage "Propellor build" build) $ |
