From 6830127f95bb6498185f5d2ed9d6328e258e3036 Mon Sep 17 00:00:00 2001 From: onovy Date: Mon, 6 Apr 2015 23:50:08 +0200 Subject: [PATCH] PR #16 fix. --- osync.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/osync.sh b/osync.sh index f988ae1..cafe883 100755 --- a/osync.sh +++ b/osync.sh @@ -4,7 +4,7 @@ PROGRAM="Osync" # Rsync based two way sync engine with fault tolerance AUTHOR="(L) 2013-2015 by Orsiris \"Ozy\" de Jong" CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr" PROGRAM_VERSION=1.00pre -PROGRAM_BUILD=2004201501 +PROGRAM_BUILD=2104201501 ## type doesn't work on platforms other than linux (bash). If if doesn't work, always assume output is not a zero exitcode if ! type -p "$BASH" > /dev/null @@ -1667,14 +1667,15 @@ function Init # remove leadng 'ssh://' uri=${SLAVE_SYNC_DIR#ssh://*} - # remove everything after '@' - _first_part=${uri%@*} - REMOTE_USER=${_first_part%;*} - if [ "$REMOTE_USER" == "" ] - then - REMOTE_USER=$(id -un) - fi - #fingerprint=${_first_part#*fingerprint=} + if [[ $uri == *@* ]] + then + # remove everything after '@' + _first_part=${uri%@*} + REMOTE_USER=${_first_part%;*} + else + REMOTE_USER=$LOCAL_USER + fi + if [ "$SSH_RSA_PRIVATE_KEY" == "" ] then SSH_RSA_PRIVATE_KEY=~/.ssh/id_rsa