Skip to content

Commit

Permalink
Rsync: check test mode should set proper dest path (#8196)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhatto committed Nov 7, 2014
1 parent 89860aa commit 3094b04
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions handlers/rsync.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 3094b04

Please sign in to comment.