chiark / gitweb /
Index: debian/changelog
[chiark-utils.git] / backup / snaprsync
index 3e3391fb6ac6d3d7b933e7c8919ab25e044a4c4a..4d2f3ecb6d01b6b44d04d723ca4ff786a268df19 100755 (executable)
@@ -13,6 +13,8 @@
        rvardir=/var/lib/chiark-backup
        bwlimit=
        subdir=.
+       rsyncopts=
+       summer=summer
 
 set -e
 
@@ -23,13 +25,13 @@ xwait () { eval "echo \"+[\$${1}pid] ($1)...\"; wait \$${1}pid;"; }
 
 while true; do
        case "$1" in
-       --?*=?*)
+       --?*=*)
                name=${1#--}; name=${name%%=*}
                value=${1#--*=}
                case "$name" in
                rhost|device|mountpoint|localarea);;
                localprevious|snapkind|rsharedir|retcdir|rvardir|bwlimit);;
-               subdir);;
+               subdir|rsyncopts|summer);;
                *) badusage "unknown setting $name";;
                esac
                eval "$name=\$value"
@@ -62,7 +64,7 @@ ssh $rhost "$sshpfx ls -d $rvardir"
 test -d $localarea || x mkdir $localarea
 ournode=`uname -n`
 rsumsfile=for-$ournode.sums
-summer='summer -ACDbtqf'
+summer="$summer -ACDbtqf"
 
 td=/dev/enoent
 rc=12
@@ -96,7 +98,7 @@ ssh $rhost <$td/sentinel 4<&- "
   cd ..
 " &
 xspawned rsum
-x $rsync -aHSxz --numeric-ids --delete \
+x $rsync -aHSxz --numeric-ids --delete $rsyncopts \
        ${localprevious:+--link-dest} $localprevious \
        $rhost:$rvardir/snap-mount/$subdir $localarea/.
 date -u "+ $datefmt rsyncdone"
@@ -112,7 +114,7 @@ exec 4<&-
 date -u "+ $datefmt sumsdone"
 x ssh $rhost "$sshpfx $rsharedir/snap-drop"
 
-if [ "x${localprevious}" != x ]; then
+if [ "x${localprevious}" != x ] && test -f "$localprevious,rsums"; then
        cp "$localprevious,rsums" "$localarea,rsums"
 fi
 x $rsync -p \