diff --git a/install.sh b/install.sh index 7ab4ca3..8152238 100644 --- a/install.sh +++ b/install.sh @@ -4,30 +4,6 @@ uname=$(whoami) admintoken=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c16) -# Choice for DNS or IP -PS3='Choose your preferred option, IP or DNS/Domain:' -WAN=("IP" "DNS/Domain") -select WANOPT in "${WAN[@]}"; do -case $WANOPT in -"IP") -wanip=$(dig @resolver4.opendns.com myip.opendns.com +short) -break -;; - -"DNS/Domain") -echo -ne "Enter your preferred domain/dns address ${NC}: " -read wanip -#check wanip is valid domain -if ! [[ $wanip =~ ^[a-zA-Z0-9]+([a-zA-Z0-9.-]*[a-zA-Z0-9]+)?$ ]]; then - echo -e "${RED}Invalid domain/dns address${NC}" - exit 1 -fi -break -;; -*) echo "invalid option $REPLY";; -esac -done - # identify OS if [ -f /etc/os-release ]; then # freedesktop.org and systemd @@ -102,6 +78,32 @@ else exit 1 fi +# Choice for DNS or IP +PS3='Choose your preferred option, IP or DNS/Domain:' +WAN=("IP" "DNS/Domain") +select WANOPT in "${WAN[@]}"; do +case $WANOPT in +"IP") +wanip=$(dig @resolver4.opendns.com myip.opendns.com +short) +break +;; + +"DNS/Domain") +echo -ne "Enter your preferred domain/dns address ${NC}: " +read wanip +#check wanip is valid domain +if ! [[ $wanip =~ ^[a-zA-Z0-9]+([a-zA-Z0-9.-]*[a-zA-Z0-9]+)?$ ]]; then + echo -e "${RED}Invalid domain/dns address${NC}" + exit 1 +fi +break +;; +*) echo "invalid option $REPLY";; +esac +done + + + # #/* # Alternatively since case is faster than if then else # case ${IDLIKE} in