mirror of
https://github.com/vmstan/gravity-sync.git
synced 2024-08-30 18:22:11 +00:00
Attempt to install ssh and rsync
This commit is contained in:
parent
c63507c6c3
commit
385ef3812c
182
gravity-sync.sh
182
gravity-sync.sh
@ -79,7 +79,7 @@ function import_gs {
|
||||
source $HOME/${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
error_validate
|
||||
|
||||
MESSAGE="Using ${REMOTE_USER}@${REMOTE_HOST}"
|
||||
MESSAGE="Targeting ${REMOTE_USER}@${REMOTE_HOST}"
|
||||
echo_info
|
||||
|
||||
detect_ssh
|
||||
@ -592,6 +592,100 @@ function validate_os_sshpass {
|
||||
error_validate
|
||||
}
|
||||
|
||||
|
||||
## Detect SSH-KEYGEN
|
||||
function detect_sshkeygen {
|
||||
MESSAGE="Checking for SSH-KEYGEN"
|
||||
echo_stat
|
||||
|
||||
if hash ssh-keygen 2>/dev/null
|
||||
then
|
||||
echo_good
|
||||
else
|
||||
echo_fail
|
||||
MESSAGE="SSH-KEYGEN is Required"
|
||||
echo_info
|
||||
MESSAGE="Attempting to Compensate"
|
||||
echo_info
|
||||
|
||||
if hash dropbearkey 2>/dev/null
|
||||
then
|
||||
MESSAGE="Using DROPBEARKEY Instead"
|
||||
echo_info
|
||||
KEYGEN_COMMAND="dropbearkey -t rsa -f"
|
||||
|
||||
else
|
||||
MESSAGE="No Alternatives Located"
|
||||
echo_info
|
||||
exit_nochange
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
## Detect Package Manager
|
||||
function distro_check {
|
||||
if hash apt-get 2>/dev/null
|
||||
then
|
||||
PKG_MANAGER="apt-get"
|
||||
PKG_INSTALL="sudo ${PKG_MANAGER} --yes --no-install-recommends install"
|
||||
elif hash rpm 2>/dev/null
|
||||
then
|
||||
if hash dnf 2>/dev/null
|
||||
then
|
||||
PKG_MANAGER="dnf"
|
||||
elif hash yum 2>/dev/null
|
||||
then
|
||||
PKG_MANAGER="yum"
|
||||
else
|
||||
MESSAGE="Unable to find OS Package Manager"
|
||||
echo_info
|
||||
exit_nochange
|
||||
fi
|
||||
PKG_INSTALL="sudo ${PKG_MANAGER} install -y"
|
||||
else
|
||||
MESSAGE="Unable to find OS Package Manager"
|
||||
echo_info
|
||||
exit_nochange
|
||||
fi
|
||||
}
|
||||
|
||||
## Detect SSH & RSYNC
|
||||
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
|
||||
|
||||
MESSAGE="Installing SSH"
|
||||
echo_stat
|
||||
${PKG_INSTALL} ssh 2>/dev/null
|
||||
error_validate
|
||||
fi
|
||||
|
||||
MESSAGE="Checking for RSYNC Client on $HOSTNAME"
|
||||
echo_stat
|
||||
|
||||
if hash rsync 2>/dev/null
|
||||
then
|
||||
echo_good
|
||||
else
|
||||
echo_fail
|
||||
MESSAGE="${PROGRAM} requires RSYNC be installed"
|
||||
echo_info
|
||||
|
||||
MESSAGE="Installing RSYNC"
|
||||
echo_stat
|
||||
${PKG_INSTALL} rsync 2>/dev/null
|
||||
error_validate
|
||||
fi
|
||||
}
|
||||
|
||||
## Error Validation
|
||||
function error_validate {
|
||||
if [ "$?" != "0" ]; then
|
||||
@ -832,92 +926,6 @@ function config_generate {
|
||||
exit_withchange
|
||||
}
|
||||
|
||||
## Detect SSH-KEYGEN
|
||||
function detect_sshkeygen {
|
||||
MESSAGE="Checking for SSH-KEYGEN"
|
||||
echo_stat
|
||||
|
||||
if hash ssh-keygen 2>/dev/null
|
||||
then
|
||||
echo_good
|
||||
else
|
||||
echo_fail
|
||||
MESSAGE="SSH-KEYGEN is Required"
|
||||
echo_info
|
||||
MESSAGE="Attempting to Compensate"
|
||||
echo_info
|
||||
|
||||
if hash dropbearkey 2>/dev/null
|
||||
then
|
||||
MESSAGE="Using DROPBEARKEY Instead"
|
||||
echo_info
|
||||
KEYGEN_COMMAND="dropbearkey -t rsa -f"
|
||||
|
||||
else
|
||||
MESSAGE="No Alternatives Located"
|
||||
echo_info
|
||||
exit_nochange
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
## Detect Package Manager
|
||||
function distro_check {
|
||||
if hash apt-get 2>/dev/null
|
||||
then
|
||||
PKG_MANAGER="apt-get"
|
||||
PKG_INSTALL="sudo ${PKG_MANAGER} --yes --no-install-recommends install"
|
||||
elif hash rpm 2>/dev/null
|
||||
then
|
||||
if hash dnf 2>/dev/null
|
||||
then
|
||||
PKG_MANAGER="dnf"
|
||||
elif hash yum 2>/dev/null
|
||||
then
|
||||
PKG_MANAGER="yum"
|
||||
else
|
||||
MESSAGE="Unable to find OS Package Manager"
|
||||
echo_info
|
||||
exit_nochange
|
||||
fi
|
||||
PKG_INSTALL="sudo ${PKG_MANAGER} install -y"
|
||||
else
|
||||
MESSAGE="Unable to find OS Package Manager"
|
||||
echo_info
|
||||
exit_nochange
|
||||
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
|
||||
|
||||
MESSAGE="Checking for RSYNC Client on $HOSTNAME"
|
||||
echo_stat
|
||||
|
||||
if hash rsync 2>/dev/null
|
||||
then
|
||||
echo_good
|
||||
else
|
||||
echo_fail
|
||||
MESSAGE="${PROGRAM} requires RSYNC be installed"
|
||||
echo_info
|
||||
|
||||
exit_nochange
|
||||
fi
|
||||
}
|
||||
|
||||
## Delete Existing Configuration
|
||||
function config_delete {
|
||||
source $HOME/${LOCAL_FOLDR}/${CONFIG_FILE}
|
||||
|
Loading…
Reference in New Issue
Block a user