#!/bin/sh
exec 1>&2
env | grep RSYNC | sort | tr '\n' '\t'; echo
set -x
case $RSYNC_MODULE_NAME in
(*.push) ;;
(*) exit 1;;
esac
for m in $RSYNC_MODULE_PATH/.snapshot.[0-9]*; do
test -f "$m" || continue
if test -n "$erase"; then
rm -f "$m" || exit $?
elif test -n "$mark"; then
rm -f "$m" "$mark" || exit $?
erase=1
fi
mark=$m
done
test -n "$erase" && exit 0
test -f "$mark" && snap.rsync.post
exit 0