|author||Joey Hess||2020-06-18 14:53:03 -0400|
|committer||Joey Hess||2020-06-18 14:54:28 -0400|
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.
1 files changed, 4 insertions, 11 deletions
diff --git a/src/Propellor/Bootstrap.hs b/src/Propellor/Bootstrap.hs
index 7c1a3ea7..6aa5720c 100644
@@ -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"
- safetycopy = "propellor.built"
cabal_configure = ifM (cabal ["configure"])
writeFile "configured" ""