misc/build-server: make the script more atomic