From 1dd0bf5f775807747a56e389a369d72507c7216e Mon Sep 17 00:00:00 2001 From: Trevor Batley Date: Thu, 28 Sep 2023 21:39:57 +1000 Subject: [PATCH] add connection testing early in install script --- install-koji-farm.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/install-koji-farm.sh b/install-koji-farm.sh index 8081263..a9b148f 100644 --- a/install-koji-farm.sh +++ b/install-koji-farm.sh @@ -32,6 +32,7 @@ fi SCRIPT_GIT="https://src.koozali.org/smedev/smeserver-koji/raw/branch/master/koji-setup" SCRIPT_DIR="$(echo ~)/bin" +echo "Loading required scripts and packages...." ; fi mkdir -p $SCRIPT_DIR curl $SILENT $SCRIPT_GIT/koji-deploy-hub.sh > $SCRIPT_DIR/koji-deploy-hub.sh curl $SILENT $SCRIPT_GIT/koji-deploy-web.sh > $SCRIPT_DIR/koji-deploy-web.sh @@ -48,6 +49,27 @@ 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 [ ! nc -z $KOJI_WEB_FQDN 22 2>/dev/null ] ; 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 [ ! nc -z $FQDN 22 2>/dev/null ] ; 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