summaryrefslogtreecommitdiff
path: root/src/Propellor/Bootstrap.hs
diff options
context:
space:
mode:
authorJoey Hess2015-02-28 14:00:53 -0400
committerJoey Hess2015-02-28 14:00:53 -0400
commitf7a02ae4ff8834a1117639cff6198d9dc05e316f (patch)
treef5e34e1111e8c28812da733dc342f689e896d0fc /src/Propellor/Bootstrap.hs
parentec64af82f0f87df939abb6dd0727628a2cd88906 (diff)
better deps installation
Less special cases, and will work more broadly.
Diffstat (limited to 'src/Propellor/Bootstrap.hs')
-rw-r--r--src/Propellor/Bootstrap.hs30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/Propellor/Bootstrap.hs b/src/Propellor/Bootstrap.hs
index 45340832..214f65d5 100644
--- a/src/Propellor/Bootstrap.hs
+++ b/src/Propellor/Bootstrap.hs
@@ -13,7 +13,7 @@ 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
+-- host. Should be run inside the propellor config dir, and will install
-- all necessary build dependencies.
bootstrapPropellorCommand :: ShellCommand
bootstrapPropellorCommand = "if ! test -x ./propellor; then " ++ go ++ "; fi"
@@ -30,23 +30,34 @@ buildCommand = intercalate " && "
, "ln -sf dist/build/propellor-config/propellor-config propellor"
]
+-- Install build dependencies of propellor.
+--
+-- First, try to install ghc, cabal, gnupg, and all haskell libraries that
+-- propellor uses from OS packages.
+--
+-- Some packages may not be available in some versions of Debian
+-- (eg, Debian wheezy lacks async), or propellor may need a newer version.
+-- So, as a second step, cabal is used to install all dependencies.
+--
+-- Note: May succeed and leave some deps not installed.
depsCommand :: ShellCommand
-depsCommand =
- "(" ++ aptinstall debdeps ++ " || (apt-get update && " ++ aptinstall debdeps ++ ")) && "
- ++ "(" ++ aptinstall ["libghc-async-dev"] ++ " || (" ++ cabalinstall ["async"] ++ ")) || "
- ++ "(" ++ cabalinstall ["--only-dependencies"] ++ ")"
+depsCommand = "( " ++ intercalate " ; " (concat [osinstall, cabalinstall]) ++ " ) || true"
where
- aptinstall ps = "apt-get --no-upgrade --no-install-recommends -y install " ++ unwords ps
+ osinstall = "apt-get update" : map aptinstall debdeps
- cabalinstall ps = "cabal update; cabal install " ++ unwords ps
+ cabalinstall =
+ [ "cabal update"
+ , "cabal install --only-dependencies"
+ ]
+
+ aptinstall p = "apt-get --no-upgrade --no-install-recommends -y install " ++ p
-- 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-async-dev"
, "libghc-missingh-dev"
, "libghc-hslogger-dev"
, "libghc-unix-compat-dev"
@@ -58,7 +69,6 @@ depsCommand =
, "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"