move -maxdepth 1 option before -type d due to find giving this warning when it is...
[matthijs/upstream/backupninja.git] / handlers / maildir.in
index 0d88e9271ef016702574c1295bd4005a9cf22069..34668fb66e7e214c3c57fc0c2bb09c856bf9d673 100644 (file)
@@ -62,7 +62,10 @@ srcdir=${srcdir%/}
 
 [ "$multiconnection" == "notset" ] && fatal "The maildir handler uses a very different destination format. See the example .maildir for more information"
 
-[ ! $test ] || testflags="--dry-run -v"
+if [ $test ]; then
+   testflags="--dry-run -v"
+fi
+
 rsyncflags="$testflags -e 'ssh -p $destport' -r -v --ignore-existing --delete --size-only --bwlimit=$speedlimit"
 excludes="--exclude '.Trash/\*' --exclude '.Mistakes/\*' --exclude '.Spam/\*'"
 
@@ -154,7 +157,7 @@ function do_rotate() {
                fi
                
                # Rotate the current list of backups, if we can.
-               oldest=\`find $backuproot -type d -maxdepth 1 -name \$rottype'.*' | @SED@ 's/^.*\.//' | sort -n | tail -1\`
+               oldest=\`find $backuproot -maxdepth 1 -type d -name \$rottype'.*' | @SED@ 's/^.*\.//' | sort -n | tail -1\`
                #echo "Debug: oldest \$oldest"
                [ "\$oldest" == "" ] && oldest=0
                for (( i=\$oldest; i > 0; i-- )); do
@@ -198,7 +201,7 @@ function do_rotate() {
        for rottype in daily weekly monthly; do
                max=\$((keep\${rottype}+1))
                dir="$backuproot/\$rottype"
-               oldest=\`find $backuproot -type d -maxdepth 1 -name \$rottype'.*' | @SED@ 's/^.*\.//' | sort -n | tail -1\`
+               oldest=\`find $backuproot -maxdepth 1 -type d -name \$rottype'.*' | @SED@ 's/^.*\.//' | sort -n | tail -1\`
                [ "\$oldest" == "" ] && oldest=0 
                # if we've rotated the last backup off the stack, remove it.
                for (( i=\$oldest; i >= \$max; i-- )); do