=== modified file 'post' --- post 2014-02-18 09:54:08 +0000 +++ post 2014-02-14 17:52:02 +0000 @@ -12,26 +12,10 @@ [[ $RSYNC_MODULE_NAME != 'snaprep_new' ]] && exit 0 -f=( $RSYNC_MODULE_PATH/.snapshot.[0-9]*(N) ) -if (($#f == 0)); then - exit 0 -elif (($#f > 1)); then - rm -rf $f || exit $? -else - ts=${f##*.} - d=$RSYNC_MODULE_PATH:h - if [[ -a $d/.snapshot.$ts ]]; then - rm -rf $f || exit $? - else - rsync -a --exclude=/.snapshot.\* --link-dest=$RSYNC_MODULE_PATH/ $RSYNC_MODULE_PATH/ $d/$ts/ || exit $? - mv $f $d/ || exit $? - fi +marks=( $RSYNC_MODULE_PATH/.snapshot.[1-9]*(N) ) +if (($#marks)); then + mark=$marks[1] + dst=${RSYNC_MODULE_PATH:h}/${mark##*.snapshot.} + [[ -e $dst ]] && exit 1 + mv -v $RSYNC_MODULE_PATH $dst fi - -#marks=( $RSYNC_MODULE_PATH/.snapshot.[1-9]*(N) ) -#if (($#marks)); then -# mark=$marks[1] -# dst=${RSYNC_MODULE_PATH:h}/${mark##*.snapshot.} -# [[ -e $dst ]] && exit 1 -# mv -v $RSYNC_MODULE_PATH $dst -#fi === modified file 'pre' --- pre 2014-02-18 09:54:08 +0000 +++ pre 2014-02-14 17:52:02 +0000 @@ -1,19 +1,16 @@ #!/bin/zsh env | grep RSYNC 1>&2 set -x -# mkdir -p /tmp/snaprep/new || exit $? +mkdir -p /tmp/snaprep || exit $? [[ $RSYNC_MODULE_NAME != 'snaprep_new' ]] && exit 0 -f=( $RSYNC_MODULE_PATH/.snapshot.[0-9]*(N) ) -if (($#f)); then $0:h/post; fi - -#if ! [[ -d $RSYNC_MODULE_PATH ]]; then -# snapshots=( ${RSYNC_MODULE_PATH:h}/[1-9]*(N) ) -# if (($#snapshots)); then -# src=$snapshots[-1] -# rsync -a --exclude=/.snapshot.\* --link-dest=$src $src/ $RSYNC_MODULE_PATH/ || exit $? -# else -# mkdir -p $RSYNC_MODULE_PATH/ || exit $? -# fi -#fi +if ! [[ -d $RSYNC_MODULE_PATH ]]; then + snapshots=( ${RSYNC_MODULE_PATH:h}/[1-9]*(N) ) + if (($#snapshots)); then + src=$snapshots[-1] + rsync -a --exclude=/.snapshot.\* --link-dest=$src $src/ $RSYNC_MODULE_PATH/ || exit $? + else + mkdir -p $RSYNC_MODULE_PATH/ || exit $? + fi +fi === modified file 'rsyncd.conf' --- rsyncd.conf 2014-02-18 09:54:08 +0000 +++ rsyncd.conf 2014-02-14 17:52:02 +0000 @@ -10,6 +10,9 @@ transfer logging = yes max verbosity = 2 +pre-xfer exec = /home/ccx/bzr/snaprep/pre +post-xfer exec = /home/ccx/bzr/snaprep/post + # Simple example for enabling your own local rsync server [gentoo-portage] path = /usr/portage @@ -23,7 +26,4 @@ [snaprep_new] path = /tmp/snaprep/new read only = no - write only = yes refuse options = inplace - pre-xfer exec = /home/ccx/bzr/snaprep/pre - post-xfer exec = /home/ccx/bzr/snaprep/post === removed file 'snap.push.single' --- snap.push.single 2014-02-18 09:54:08 +0000 +++ snap.push.single 1970-01-01 00:00:00 +0000 @@ -1,5 +0,0 @@ -#!/bin/zsh -src=$1;shift -dst=$1;shift -rsync -a --delete "$@" --exclude=/.snapshot.\* $src/ $dst/ && \ -rsync -a --delete "$@" $src/ $dst/