snaprep

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

commit aaeb8f99eb6d9c492b7968f4c4f5c1e855627d2e
parent 59fb6ef3ad7f5c967293a909a768c20c9cd7ddd8
Author: Jan Pobrislo <ccx@webprojekty.cz>
Date:   Thu, 20 Feb 2014 21:50:01 +0100

untested push scripts
Diffstat:
Abin/snap.list | 3+++
Abin/snap.push | 28++++++++++++++++++++++++++++
Mbin/snap.push.single | 1+
3 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/bin/snap.list b/bin/snap.list @@ -0,0 +1,3 @@ +#!/bin/sh +rsync -li --include='.snapshot.[0-9]*' --exclude='*' "$@" | \ + awk '$5 ~ /^\.snapshot\./{ print substr($5, 11) }' diff --git a/bin/snap.push b/bin/snap.push @@ -0,0 +1,28 @@ +#!/bin/zsh +die() { + print -r - "$@" + exit 1 +} + +if [[ -z $SNAP_SRCS ]]; then + SNAP_SRCS=$1;shift +fi +SNAP_SRCS=${SNAP_SRCS%%/} + +if [[ -z $SNAP_DST ]]; then + SNAP_DST=$1;shift +fi +SNAP_DST=${SNAP_DST%%/} + +typeset -A snapshots +for ts in ${(f)"$(snap.list $SNAP_SRCS)"}; do + snapshots[$ts]=$SNAP_SRCS/$ts +done +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 "$@" +done diff --git a/bin/snap.push.single b/bin/snap.push.single @@ -21,6 +21,7 @@ marks=( $SNAP_SRC/.snapshot.[0-9]*(N) ) if [[ $SNAP_DST == *:* ]]; then # remote + [[ $SNAP_DST == *.push ]] || $SNAP_DST=$SNAP_DST.push $rsync --exclude=/.snapshot.\* $SNAP_SRC/ $SNAP_DST/ && \ $rsync $SNAP_SRC/ $SNAP_DST/ else