summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess2020-06-18 14:53:03 -0400
committerJoey Hess2020-06-18 14:54:28 -0400
commit221b71fd6321ae35c5fc0f1bdd3ac216596a2fe0 (patch)
treec86614ce74e479b4fbf8773ad128b67bfbb87de8
parentfe1e502f90faee1329fd27326de6b1bd191780fe (diff)
simplify update of propellor bin
propellor won't be a symlink to propellor.built, instead the latter is renamed over the former, atomically. If something somehow depends on propellor being a symlink, this will break it, but I don't think anything should.
-rw-r--r--src/Propellor/Bootstrap.hs15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/Propellor/Bootstrap.hs b/src/Propellor/Bootstrap.hs
index 7c1a3ea7..6aa5720c 100644
--- a/src/Propellor/Bootstrap.hs
+++ b/src/Propellor/Bootstrap.hs
@@ -269,21 +269,14 @@ cabalBuild msys = do
unlessM cabal_build $
unlessM (cabal_configure <&&> cabal_build) $
error "cabal build failed"
- -- For safety against eg power loss in the middle of the build,
- -- make a copy of the binary, and move it into place atomically.
- -- This ensures that the propellor symlink only ever points at
- -- a binary that is fully built. Also, avoid ever removing
- -- or breaking the symlink.
- --
- -- Need cp -pfRL to make build timestamp checking work.
- let cpcmd = "cp -pfRL" `commandCabalBuildTo` tmpfor safetycopy
+ -- Make a copy of the binary, and move it into place atomically.
+ let safetycopy = "propellor.built"
+ let cpcmd = "cp -pfL" `commandCabalBuildTo` safetycopy
unlessM (boolSystem "sh" [Param "-c", Param cpcmd]) $
error "cp of binary failed"
- rename (tmpfor safetycopy) safetycopy
- symlinkPropellorBin safetycopy
+ rename safetycopy "propellor"
return True
where
- safetycopy = "propellor.built"
cabal_configure = ifM (cabal ["configure"])
( do
writeFile "configured" ""