From 67df5dd266d0d05c573c6c5e0d6ab3a10055a2ed Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Sat, 30 May 2020 20:37:59 -0500 Subject: [PATCH] Look for SSH --- CHANGELOG.md | 3 ++- gravity-sync.sh | 34 ++++++++++++++++++++++------------ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f81f89..79eb3fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,8 @@ - Changelog polarity reversed after heated discussions with marketing team. - Improved method to activate development branch updates, as added in 1.7.2. - `./gravity-sync.sh dev` will now toggle dev flag on/off. No `touch` required, although it still works that way under the covers. -- Detects absence of ssh-keygen on host OS and prompts to install (DietPi) +- Detects absence of ssh client command on host OS (DietPi) +- Detects absence of ssh-keygen on host OS and will use dropbearkey as an alternative (DietPi) #### 1.7.3 - Cleaning up output of argument listing diff --git a/gravity-sync.sh b/gravity-sync.sh index 5377421..8a73333 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -720,6 +720,8 @@ function intent_validate { # Configuration Management ## Generate New Configuration function config_generate { + detect_ssh + MESSAGE="Creating ${CONFIG_FILE} from Template" echo_stat cp $HOME/${LOCAL_FOLDR}/${CONFIG_FILE}.example $HOME/${LOCAL_FOLDR}/${CONFIG_FILE} @@ -849,19 +851,11 @@ function detect_sshkeygen { echo_info KEYGEN_COMMAND="dropbearkey -t rsa -f" - MESSAGE="Installing SSH" - echo_stat - distro_check - - ${PKG_INSTALL} ssh - error_validate + MESSAGE="No Alternatives Located" + echo_info + exit_nochange else - MESSAGE="Installing SSH-KEYGEN" - echo_stat - distro_check - - ${PKG_INSTALL} ssh-keygen - error_validate + fi fi } @@ -893,6 +887,22 @@ function distro_check { fi } +function detect_ssh { + MESSAGE="Checking for SSH Client on $hostname" + echo_stat + + if hash ssh 2>/dev/null + then + echo_good + else + echo_fail + MESSAGE="${PROGRAM} requires SSH be installed" + echo_info + + exit_nochange + fi +} + ## Delete Existing Configuration function config_delete { source $HOME/${LOCAL_FOLDR}/${CONFIG_FILE}