Update install.sh

This commit is contained in:
dinger1986 2022-08-12 15:11:26 +01:00 committed by GitHub
parent fc9a935121
commit 4977bd764c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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