helm_website/docker/deployer_docker/updater.sh

25 lines
565 B
Bash
Raw Normal View History

2024-12-08 08:33:39 +01:00
#!/bin/bash
if test -z "${GL_URL}"; then
echo "No URL defined"
exit 1
fi
test -d /web/.attic || mkdir /web/.attic
if test -f /web/.attic/SNAPID; then
read snapid < /web/.attic/SNAPID
let snapid=snapid+1
echo ${snapid} > /web/.attic/SNAPID
mkdir /web/.attic/snap-${snapid}
else
echo 0 > /web/.attic/SNAPID
let snapid=0
mkdir /web/.attic/snap-${snapid}
fi
find /web -maxdepth 1 ! "(" -name ".attic" -o -wholename "/web" ")" -print0 | xargs -n 1 -0 mv -t /web/.attic/snap-${snapid}
curl "${GL_URL}" | tar -C /web --strip-components 1 -zxvf -