Improved ssh uri recognition
This commit is contained in:
parent
583998272d
commit
c472b47a73
|
@ -31,6 +31,7 @@ UNDER WORK
|
||||||
RECENT CHANGES
|
RECENT CHANGES
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
- Improved ssh uri recognition (thanks to onovy)
|
||||||
- Fixed #21 by adding portable shell readlink / realpath from https://github.com/mkropat/sh-realpath
|
- Fixed #21 by adding portable shell readlink / realpath from https://github.com/mkropat/sh-realpath
|
||||||
- Added detection of osync.sh script in osync-batch.sh to overcome mising path in crontab
|
- Added detection of osync.sh script in osync-batch.sh to overcome mising path in crontab
|
||||||
- Fixed osync-batch.sh script when osync is in executable path like /usr/local/bin
|
- Fixed osync-batch.sh script when osync is in executable path like /usr/local/bin
|
||||||
|
|
14
osync.sh
14
osync.sh
|
@ -1741,10 +1741,11 @@ function Init
|
||||||
|
|
||||||
# remove leadng 'ssh://'
|
# remove leadng 'ssh://'
|
||||||
uri=${SLAVE_SYNC_DIR#ssh://*}
|
uri=${SLAVE_SYNC_DIR#ssh://*}
|
||||||
|
if [[ "$uri" == *"@"* ]]
|
||||||
|
then
|
||||||
# remove everything after '@'
|
# remove everything after '@'
|
||||||
REMOTE_USER=${uri%@*}
|
REMOTE_USER=${uri%@*}
|
||||||
if [ "$REMOTE_USER" == "" ]
|
else
|
||||||
then
|
|
||||||
REMOTE_USER=$LOCAL_USER
|
REMOTE_USER=$LOCAL_USER
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1757,13 +1758,14 @@ function Init
|
||||||
_hosturiandpath=${uri#*@}
|
_hosturiandpath=${uri#*@}
|
||||||
# remove everything after first '/'
|
# remove everything after first '/'
|
||||||
_hosturi=${_hosturiandpath%%/*}
|
_hosturi=${_hosturiandpath%%/*}
|
||||||
# remove last part if no port defined
|
if [[ "$_hosturi" == *":"* ]]
|
||||||
REMOTE_HOST=${_hosturi%%:*}
|
|
||||||
REMOTE_PORT=${_hosturi##*:}
|
|
||||||
if [ "$REMOTE_PORT" == "" ]
|
|
||||||
then
|
then
|
||||||
|
REMOTE_PORT=${_hosturi##*:}
|
||||||
|
else
|
||||||
REMOTE_PORT=22
|
REMOTE_PORT=22
|
||||||
fi
|
fi
|
||||||
|
REMOTE_HOST=${_hosturi%%:*}
|
||||||
|
|
||||||
# remove everything before first '/'
|
# remove everything before first '/'
|
||||||
SLAVE_SYNC_DIR=${_hosturiandpath#*/}
|
SLAVE_SYNC_DIR=${_hosturiandpath#*/}
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue