Revert "Check backup type before remote system URI"

This reverts commit 52161b3faf.
This commit is contained in:
deajan 2017-02-11 11:23:29 +01:00
parent 52161b3faf
commit f4d587f1d1
1 changed files with 28 additions and 30 deletions

View File

@ -7,7 +7,7 @@ PROGRAM="obackup"
AUTHOR="(C) 2013-2017 by Orsiris de Jong" AUTHOR="(C) 2013-2017 by Orsiris de Jong"
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr" CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
PROGRAM_VERSION=2.1-beta1+dev PROGRAM_VERSION=2.1-beta1+dev
PROGRAM_BUILD=2017021101 PROGRAM_BUILD=2017021001
IS_STABLE=no IS_STABLE=no
#### Execution order #__WITH_PARANOIA_DEBUG #### Execution order #__WITH_PARANOIA_DEBUG
@ -1752,38 +1752,36 @@ function Init {
trap TrapStop INT QUIT TERM HUP trap TrapStop INT QUIT TERM HUP
trap TrapQuit EXIT trap TrapQuit EXIT
if [ "$BACKUP_TYPE_" == "pull" ] || [ "$BACKUP_TYPE" == "push" ]; then ## Test if target dir is a ssh uri, and if yes, break it down it its values
## Test if target dir is a ssh uri, and if yes, break it down it its values if [ "${REMOTE_SYSTEM_URI:0:6}" == "ssh://" ] && [ "$BACKUP_TYPE" != "local" ]; then
if [ "${REMOTE_SYSTEM_URI:0:6}" == "ssh://" ] && [ "$BACKUP_TYPE" != "local" ]; then REMOTE_OPERATION="yes"
REMOTE_OPERATION="yes"
# remove leadng 'ssh://' # remove leadng 'ssh://'
uri=${REMOTE_SYSTEM_URI#ssh://*} uri=${REMOTE_SYSTEM_URI#ssh://*}
if [[ "$uri" == *"@"* ]]; then if [[ "$uri" == *"@"* ]]; then
# remove everything after '@' # remove everything after '@'
REMOTE_USER=${uri%@*} REMOTE_USER=${uri%@*}
else else
REMOTE_USER=$LOCAL_USER REMOTE_USER=$LOCAL_USER
fi fi
if [ "$SSH_RSA_PRIVATE_KEY" == "" ]; then if [ "$SSH_RSA_PRIVATE_KEY" == "" ]; then
if [ ! -f "$SSH_PASSWORD_FILE" ]; then if [ ! -f "$SSH_PASSWORD_FILE" ]; then
# Assume that there might exist a standard rsa key # Assume that there might exist a standard rsa key
SSH_RSA_PRIVATE_KEY=~/.ssh/id_rsa SSH_RSA_PRIVATE_KEY=~/.ssh/id_rsa
fi fi
fi fi
# remove everything before '@' # remove everything before '@'
hosturiandpath=${uri#*@} hosturiandpath=${uri#*@}
# remove everything after first '/' # remove everything after first '/'
hosturi=${hosturiandpath%%/*} hosturi=${hosturiandpath%%/*}
if [[ "$hosturi" == *":"* ]]; then if [[ "$hosturi" == *":"* ]]; then
REMOTE_PORT=${hosturi##*:} REMOTE_PORT=${hosturi##*:}
else else
REMOTE_PORT=22 REMOTE_PORT=22
fi fi
REMOTE_HOST=${hosturi%%:*} REMOTE_HOST=${hosturi%%:*}
fi
fi fi
## Add update to default RSYNC_ARGS ## Add update to default RSYNC_ARGS