move connectivity checks earlier

This commit is contained in:
Trevor Batley 2023-10-03 08:21:08 +11:00
parent ed1e6c762e
commit 35cc0401d6

View File

@ -28,6 +28,37 @@ if [ $DEBUG ] ; then
QUIET="-v"
fi
echo "Checking connectivity..."
# install any required packages
if [[ -z $(dnf list installed | grep epel-release) ]] ; then
dnf install -y epel-release $QUIET
fi
if [[ -z $(dnf list installed | grep netcat) ]] ; then
dnf install -y netcat $QUIET
fi
if [[ ! $KOJI_WEB_FQDN = $KOJI_HUB_FQDN ]] ; then
# check that I can conmnect
if [[ -z $(nc -z $KOJI_WEB_FQDN 22 2>&1 | grep succeeded) ]] ; then
echo "I cannot connect to the web server at $KOJI_WEB_FQDN! Is it online? "
echo "Options:"
echo "- turn on the server"
echo "- add this server into the /etc/hosts file on this server"
exit 1
fi
fi
for FQDN in ${KOJI_BUILD_FQDNS} ; do
# check that I can conmnect
if [[ -z $(nc -z $FQDN 22 2>&1 | grep succeeded) ]] ; then
echo "I cannot connect to builder at $FQDN! Is it online? "
echo "Options:"
echo "- turn on the server"
echo "- add this server into the /etc/hosts file on this server"
exit 1
fi
done
# pull down the deploy scripts
SCRIPT_GIT="https://src.koozali.org/smedev/smeserver-koji/raw/branch/master/koji-setup"
SCRIPT_DIR="$(echo ~)/bin"
@ -41,37 +72,6 @@ curl $SILENT $SCRIPT_GIT/koji-bootstrap-build.sh > $SCRIPT_DIR/koji-bootstrap-bu
curl $SILENT $SCRIPT_GIT/koji-add-user.sh > $SCRIPT_DIR/koji-add-user.sh
chmod o+x $SCRIPT_DIR/*.sh
# install any required packages
if [[ -z $(dnf list installed | grep epel-release) ]] ; then
dnf install -y epel-release $QUIET
fi
if [[ -z $(dnf list installed | grep netcat) ]] ; then
dnf install -y netcat $QUIET
fi
if [[ ! $KOJI_WEB_FQDN = $KOJI_HUB_FQDN ]] ; then
# check that I can conmnect
RESP=$(nc -z $KOJI_WEB_FQDN 22 2>&1 | grep succeeded)
if [[ -z $RESP ]] ; then
echo "I cannot connect to the web server at $KOJI_WEB_FQDN! Is it online? "
echo "Options:"
echo "- turn on the server"
echo "- add this server into the /etc/hosts file on this server"
exit 1
fi
fi
for FQDN in ${KOJI_BUILD_FQDNS} ; do
# check that I can conmnect
RESP=$(nc -z $FQDN 22 2>&1 | grep succeeded)
if [[ -z $RESP ]] ; then
echo "I cannot connect to builder at $FQDN! Is it online? "
echo "Options:"
echo "- turn on the server"
echo "- add this server into the /etc/hosts file on this server"
exit 1
fi
done
# ask for required parameters (ssh settings and build server FQDN)
echo "Please enter the following details for generating your SSL keys"
while true ; do