if sshpass fails, run normal ssh. check for dialog

This commit is contained in:
nachoparker 2017-03-05 22:53:33 +01:00
parent 94c0e8f6ba
commit d29894b4ee
2 changed files with 11 additions and 2 deletions

View File

@ -58,7 +58,14 @@ function ssh_pi()
-o ConnectTimeout=20\
-o LogLevel=quiet )
type sshpass &>/dev/null && local SSHPASS=( sshpass -p$PIPASS )
${SSHPASS[@]} ${SSH[@]} ${PIUSER}@$IP $ARGS
if [[ "${SSHPASS[@]}" == "" ]]; then
${SSH[@]} ${PIUSER}@$IP $ARGS;
else
${SSHPASS[@]} ${SSH[@]} ${PIUSER}@$IP $ARGS
local RET=$?
[[ $RET -eq 5 ]] && { ${SSH[@]} ${PIUSER}@$IP $ARGS; return $?; }
return $RET
fi
}
function wait_SSH()
@ -87,6 +94,8 @@ function config()
local INSTALL_SCRIPT="$1"
local BACKTITLE="NextCloudPi installer configuration"
type dialog &>/dev/null || { echo "please, install dialog for interactive configuration"; return 1; }
test -f "$INSTALL_SCRIPT" || { echo "file "$INSTALL_SCRIPT" not found"; return 1; }
local VARS=( $( grep "^[[:alpha:]]\+_=" "$INSTALL_SCRIPT" | cut -d= -f1 | sed 's|_$||' ) )
local VALS=( $( grep "^[[:alpha:]]\+_=" "$INSTALL_SCRIPT" | cut -d= -f2 ) )

View File

@ -14,7 +14,7 @@
# ./no-ip.sh
#
# Notes:
# Note that you need network connectivity for the installation to register with no-ip.org
# Note that you need internet access for the installation to register with no-ip.org
#
set -xe