commit 65435009052e82d810710a79080422e1c0418457 parent aaeb8f99eb6d9c492b7968f4c4f5c1e855627d2e Author: Jan Pobrislo <ccx@webprojekty.cz> Date: Thu, 20 Feb 2014 22:22:51 +0100 create snapshot mark in rsync post-xfer script Diffstat:
| M | bin/snap.push | | | 13 | +++++++++---- |
| M | bin/snap.rsync.post | | | 1 | + |
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/bin/snap.push b/bin/snap.push @@ -15,14 +15,19 @@ fi SNAP_DST=${SNAP_DST%%/} typeset -A snapshots -for ts in ${(f)"$(snap.list $SNAP_SRCS)"}; do +for ts in ${(f)"$(snap.list $SNAP_SRCS/)"}; do snapshots[$ts]=$SNAP_SRCS/$ts done -for ts in ${(f)"$(snap.list $SNAP_DST)"}; do + +for ts in ${(f)"$(snap.list $SNAP_DST/)"}; do unset "snapshots[$ts]" done export SNAP_SRC SNAP_DST -for SNAP_SRC in ${(k)snap_src}; do - snap.push.single "$@" +for SNAP_SRC in $snapshots; do + if [[ -o xtrace ]]; then + zsh -x $commands[snap.push.single] "$@" + else + snap.push.single "$@" + fi done diff --git a/bin/snap.rsync.post b/bin/snap.rsync.post @@ -27,4 +27,5 @@ fi ts=${mark##*.} rsync -aA --exclude=/.snapshot.\* --link-dest="$RSYNC_MODULE_PATH/" "$RSYNC_MODULE_PATH/" "$snap_dir/$ts/" || exit $? +touch "$snap_dir/$ts/${mark##*/}" || exit $? mv "$mark" "$snap_dir/" || exit $?