install.sh: make updates less disruptive
commit18c9c9023114c4344a62dd9f96b09b9028f63b74
authorKyle J. McKay <mackyle@gmail.com>
Mon, 21 Nov 2016 02:30:20 +0000 (20 18:30 -0800)
committerKyle J. McKay <mackyle@gmail.com>
Mon, 21 Nov 2016 02:30:20 +0000 (20 18:30 -0800)
treedb55489a6ea63f504d75b55c774f5b25a1facced
parentdb3365305117e9303df0ff419614f0ca61bf2e88
install.sh: make updates less disruptive

Although there is no way to atomically replace one directory with
another in a POSIX-ish way that works on all platforms, we can
quickly rename the previous one out of the way and then rename the
new one into place.

Instead of the previous hodgepodge updating in place, we now install
into basedir-new, webroot-new and cgibin-new and then rename the old
out of the way and the new into place.

Unfortunately the two renames are not atomic, but they are very
fast and compared to the previous technique should substantially
reduce the window of opportunity for something to be in a non-working
order during an update.

To further reduce the liklihood of something trying to operate during
the brief window of the update, a utility could be created that makes
the library rename function calls consequtively and almost instantly
after one another, but that would only further reduce the window not
eliminate it and so that's left for a future potential update.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
install.sh