snaprep

git mirror of https://ccx.te2000.cz/bzr/snaprep
git clone https://ccx.te2000.cz/git/snaprep
Log | Files | Refs

snap.rsync.pre (418B)


      1 #!/bin/sh
      2 exec 1>&2
      3 env | grep RSYNC | sort | tr '\n' '\t'; echo
      4 set -x
      5 
      6 case $RSYNC_MODULE_NAME in
      7 	(*.push) ;;
      8 	(*) exit 1;;
      9 esac
     10 
     11 for m in $RSYNC_MODULE_PATH/.snapshot.[0-9]*; do
     12 	test -f "$m" || continue
     13 	if test -n "$erase"; then
     14 		rm -f "$m" || exit $?
     15 	elif test -n "$mark"; then
     16 		rm -f "$m" "$mark" || exit $?
     17 		erase=1
     18 	fi
     19 	mark=$m
     20 done
     21 
     22 test -n "$erase" && exit 0
     23 
     24 test -f "$mark" && snap.rsync.post
     25 exit 0