=== removed file 'bin/snap.missing' --- bin/snap.missing 2014-02-20 23:18:54 +0000 +++ bin/snap.missing 1970-01-01 00:00:00 +0000 @@ -1,19 +0,0 @@ -#!/bin/awk -f -BEGIN { - if (ARGC != 2) { - print "usage: snap.missing source destination" - exit 2 - } - - while ("snap.list " ARGV[1] | getline) { - snapshots[$0] = 1 - } - - while ("snap.list " ARGV[2] | getline) { - snapshots[$0] = 0 - } - - for (ts in snapshots) { - if (snapshots[ts]) print ts - } -} === removed file 'bin/snap.push' --- bin/snap.push 2014-02-20 23:18:54 +0000 +++ bin/snap.push 1970-01-01 00:00:00 +0000 @@ -1,37 +0,0 @@ -#!/bin/sh -: ${SNAP_SRCS:=.} - -usage() { - printf >&2 "Usage: %s: [-S SNAP_SRCS] [-D SNAP_DST] [-] [RSYNC_ARGS]\n" $(basenam "$0") - exit 2 -} - -die() { - printf "%s" "$*" - exit 1 -} - -while getopts S:D: opt; do - case $opt in - (S) SNAP_SRCS=$OPTARG;; - (D) SNAP_DST=$OPTARG;; - (?) usage;; - (h) usage;; - esac -done - -case $1 in - (-) shift;; - (--) shift;; -esac - -if test -z "$SNAP_DST"; then - echo >&2 "SNAP_DST is required either as env var or argument" - usage -fi - -export SNAP_DST - -snap.missing "$SNAP_SRCS" "$SNAP_DST" | while read ts; do - snap.push.single -S "$SNAP_SRCS/$ts" - "$@" -done === renamed file 'bin/snap.push.zsh' => 'bin/snap.push' === removed file 'bin/snap.push.single' --- bin/snap.push.single 2014-02-20 23:18:54 +0000 +++ bin/snap.push.single 1970-01-01 00:00:00 +0000 @@ -1,88 +0,0 @@ -#!/bin/sh -: ${SNAP_SRC:=.} - -usage() { - printf >&2 "Usage: %s: [-S SNAP_SRC] [-D SNAP_DST] [-] [RSYNC_ARGS]\n" $(basenam "$0") - exit 2 -} - -die() { - printf "%s" "$*" - exit 1 -} - -while getopts S:D: opt; do - case $opt in - (S) SNAP_SRC=$OPTARG;; - (D) SNAP_DST=$OPTARG;; - (?) usage;; - (h) usage;; - esac -done - -case $1 in - (-) shift;; - (--) shift;; -esac - -if test -z "$SNAP_DST"; then - echo >&2 "SNAP_DST is required either as env var or argument" - usage -fi - -check_local() { - for m in $SNAP_SRC/.snapshot.[0-9]*; do - test -f "$m" || continue - test -n "$mark" && die "duplicate snapshot mark" - mark=$m - done - - test -f "$mark" || die "snapshot mark not found" - ts=${mark##*.} -} - -check_remote() { - snap.list "$SNAP_SRC/" | while read m; do - test -n "$ts" && die "duplicate snapshot mark" - ts=$m - done - test -n "$ts" || die "snapshot mark not found" -} - -rs() { - rsync -aA --delete -} - -push_remote() { - # remote - case "$SNAP_DST" in - (*.push) ;; - (*) SNAP_DST=${SNAP_DST}.push;; - esac - rs "$@" --exclude=/.snapshot.\* "$SNAP_SRC/" "$SNAP_DST/" && \ - rs "$@" "$SNAP_SRC/" "$SNAP_DST/" -} - -push_local() { - test -d "$SNAP_DST" || die "destination not a directory: ${SNAP_DST}" - snapshot=$(snap.list "$SNAP_DST" | tail -1) - if test -n $snapshot; then - link=${SNAP_DST}/${snapshots} - rs "$@" "--link-dest=$link" "$SNAP_SRC/" "$SNAP_DST/$ts/" || exit $? - else - rs "$@" "$SNAP_SRC/" "$SNAP_DST/$ts/" || exit $? - fi - touch "${SNAP_DST}/${marks##*/}" -} - -case "$SNAP_SRC" in - (*:*) check_remote;; - (*) check_local;; -esac - -case "$SNAP_DST" in - (rsync:*) push_remote;; - (*::*) push_remote;; - (*:*) die "pushing via remote shell directly not supported, use -e with rsync:// instead";; - (*) push_local;; -esac === renamed file 'bin/snap.push.single.zsh' => 'bin/snap.push.single' --- bin/snap.push.single.zsh 2014-02-20 23:18:54 +0000 +++ bin/snap.push.single 2014-02-20 20:50:01 +0000 @@ -21,7 +21,7 @@ if [[ $SNAP_DST == *:* ]]; then # remote - [[ $SNAP_DST == *.push ]] || SNAP_DST=$SNAP_DST.push + [[ $SNAP_DST == *.push ]] || $SNAP_DST=$SNAP_DST.push $rsync --exclude=/.snapshot.\* $SNAP_SRC/ $SNAP_DST/ && \ $rsync $SNAP_SRC/ $SNAP_DST/ else