aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-11-07 15:16:30 -0200
committerSilvio Rhatto <rhatto@riseup.net>2014-11-07 15:16:30 -0200
commit3094b04da513a2741f04eea7ce2087d4409372f5 (patch)
tree7eaefa2bb0e66dab5ccad00815a1b6512bd4fd00
parent89860aa3f6dc3e0ad4eb263c382d37a92746b68d (diff)
downloadbackupninja-bug/8196.tar.gz
backupninja-bug/8196.tar.bz2
Rsync: check test mode should set proper dest path (#8196)bug/8196
-rw-r--r--handlers/rsync.in44
1 files changed, 23 insertions, 21 deletions
diff --git a/handlers/rsync.in b/handlers/rsync.in
index ee2b733..8cad073 100644
--- a/handlers/rsync.in
+++ b/handlers/rsync.in
@@ -747,25 +747,24 @@ function move_files {
function prepare_storage {
- if [ "$test" ]; then
- return
- fi
-
section="`basename $SECTION`"
if [ "$format" == "short" ]; then
suffix="$section.0"
- info "Rotating $backupdir/$SECTION..."
- echo "Rotating $backupdir/$SECTION..." >> $log
- if [ "$dest" == "remote" ]; then
- rotate_short_remote $backupdir/$SECTION/$section $keep
- else
- rotate_short $backupdir/$SECTION/$section $keep
- if [ ! -d "$backupdir/$SECTION/$section.0" ]; then
- mkdir -p $backupdir/$SECTION/$section.0
- fi
+ if [ ! "$test" ]; then
+ info "Rotating $backupdir/$SECTION..."
+ echo "Rotating $backupdir/$SECTION..." >> $log
+
+ if [ "$dest" == "remote" ]; then
+ rotate_short_remote $backupdir/$SECTION/$section $keep
+ else
+ rotate_short $backupdir/$SECTION/$section $keep
+ if [ ! -d "$backupdir/$SECTION/$section.0" ]; then
+ mkdir -p $backupdir/$SECTION/$section.0
+ fi
+ fi
fi
elif [ "$format" == "long" ]; then
@@ -781,15 +780,18 @@ function prepare_storage {
fi
suffix="$btype.1"
- info "Rotating $backupdir/$SECTION/..."
- echo "Rotating $backupdir/$SECTION/..." >> $log
- if [ "$dest" == "remote" ]; then
- rotate_long_remote $backupdir/$SECTION
- setup_long_dirs_remote $backupdir/$SECTION $btype
- else
- rotate_long $backupdir/$SECTION
- setup_long_dirs $backupdir/$SECTION $btype
+ if [ ! "$test" ]; then
+ info "Rotating $backupdir/$SECTION/..."
+ echo "Rotating $backupdir/$SECTION/..." >> $log
+
+ if [ "$dest" == "remote" ]; then
+ rotate_long_remote $backupdir/$SECTION
+ setup_long_dirs_remote $backupdir/$SECTION $btype
+ else
+ rotate_long $backupdir/$SECTION
+ setup_long_dirs $backupdir/$SECTION $btype
+ fi
fi
elif [ "$format" == "mirror" ]; then