summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--src/Propellor/Bootstrap.hs21
2 files changed, 13 insertions, 9 deletions
diff --git a/.gitignore b/.gitignore
index 4e1b918c..50258d53 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
/propellor
+/propellor.built
dist/*
dist-newstyle/*
tags
diff --git a/src/Propellor/Bootstrap.hs b/src/Propellor/Bootstrap.hs
index 58ffa61b..7c1a3ea7 100644
--- a/src/Propellor/Bootstrap.hs
+++ b/src/Propellor/Bootstrap.hs
@@ -81,18 +81,21 @@ buildCommand bs = intercalate " && " (go (getBuilder bs))
go Cabal =
[ "cabal configure"
, "cabal build -j1 propellor-config"
- , intercalate "; "
- [ "if [ -d dist-newstyle ]"
- , "then ln -sf $(cabal exec -- sh -c 'command -v propellor-config') propellor"
- , "else ln -sf dist/build/propellor-config/propellor-config propellor"
- , "fi"
- ]
+ , "ln -sf" `commandCabalBuildTo` "propellor"
]
go Stack =
[ "stack build :propellor-config"
, "ln -sf $(stack path --dist-dir)/build/propellor-config/propellor-config propellor"
]
+commandCabalBuildTo :: ShellCommand -> FilePath -> ShellCommand
+commandCabalBuildTo cmd dest = intercalate "; "
+ [ "if [ -d dist-newstyle ]"
+ , "then " ++ cmd ++ " $(cabal exec -- sh -c 'command -v propellor-config') " ++ shellEscape dest
+ , "else " ++ cmd ++ " dist/build/propellor-config/propellor-config " ++ shellEscape dest
+ , "fi"
+ ]
+
-- Check if all dependencies are installed; if not, run the depsCommand.
checkDepsCommand :: Bootstrapper -> Maybe System -> ShellCommand
checkDepsCommand bs sys = go (getBuilder bs)
@@ -273,14 +276,14 @@ cabalBuild msys = do
-- or breaking the symlink.
--
-- Need cp -pfRL to make build timestamp checking work.
- unlessM (boolSystem "cp" [Param "-pfRL", Param cabalbuiltbin, Param (tmpfor safetycopy)]) $
+ let cpcmd = "cp -pfRL" `commandCabalBuildTo` tmpfor safetycopy
+ unlessM (boolSystem "sh" [Param "-c", Param cpcmd]) $
error "cp of binary failed"
rename (tmpfor safetycopy) safetycopy
symlinkPropellorBin safetycopy
return True
where
- cabalbuiltbin = "dist/build/propellor-config/propellor-config"
- safetycopy = cabalbuiltbin ++ ".built"
+ safetycopy = "propellor.built"
cabal_configure = ifM (cabal ["configure"])
( do
writeFile "configured" ""