]> BookStack Code Mirror - devops/commitdiff
Added domain provided check to ubuntu install script
authorDan Brown <redacted>
Sat, 25 Sep 2021 19:59:00 +0000 (20:59 +0100)
committerDan Brown <redacted>
Sat, 25 Sep 2021 19:59:00 +0000 (20:59 +0100)
Related to #30

scripts/installation-ubuntu-20.04.sh

index b55f1e751e2a2ee74082e3d20c571a760414ee7d..410ade6d147aec233957377f17bdfaddc32e0059 100644 (file)
@@ -12,6 +12,14 @@ printf "Enter the domain you want to host BookStack and press [ENTER]\nExamples:
 read -r DOMAIN
 fi
 
+# Ensure a domain was provided otherwise display
+# an error message and stop the script
+if [ -z "$DOMAIN" ]
+then
+  >&2 echo 'ERROR: A domain must be provided to run this script'
+  exit 1
+fi
+
 # Get the current machine IP address
 CURRENT_IP=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1  -d'/')