#!/bin/zsh
zmodload zsh/stat || exit $?
zmodload zsh/datetime || exit $?
set -x
cd $0:h || exit $?
dst=./versions/compiled.$EPOCHSECONDS
s6-rc-compile $dst.new source || exit $?
s6-rename $dst.new $dst || exit $?
s6-rc-update -v 2 $(realpath $dst) || exit $?
s6-rc -u change ok-all || exit $?
exec s6-ln -s -f -n $dst compiled