#!/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 -