25 lines
622 B
Bash
25 lines
622 B
Bash
#!/bin/sh
|
|
set -eu
|
|
|
|
if [ "$#" -ne 1 ] || [ -z "$1" ]; then
|
|
echo "usage: $0 GIT_COMMIT" >&2
|
|
exit 2
|
|
fi
|
|
|
|
commit=$1
|
|
root=/opt/ces-controller
|
|
release="$root/releases/$commit"
|
|
temporary_link="$root/.current.$$"
|
|
|
|
install -d -m 700 "$root" "$root/releases" "$release"
|
|
install -m 700 controller.py "$release/controller.py"
|
|
install -m 600 README.md "$release/README.md"
|
|
printf '%s\n' "$commit" > "$release/VERSION"
|
|
chmod 600 "$release/VERSION"
|
|
|
|
ln -s "$release" "$temporary_link"
|
|
mv -Tf "$temporary_link" "$root/current"
|
|
install -m 755 scripts/ces-controller /usr/local/bin/ces-controller
|
|
|
|
echo "deployed_controller=$commit"
|