get local IP for substitution
This commit is contained in:
parent
bf28658a43
commit
1d7aac147e
24
setup.sh
24
setup.sh
@ -30,6 +30,28 @@ echo "pressing ENTER (i.e. no answer)."
|
||||
echo -e "You may exit this script at any prompt by typing 'X'${norm}\n"
|
||||
|
||||
|
||||
|
||||
### get local IP address
|
||||
while true; do
|
||||
read -p "What is this NGINX machine's primary local IP4 address? (${detectedIP}) " inputIP
|
||||
case "${inputIP}" in
|
||||
'')
|
||||
IP4="${detectedIP}"
|
||||
break
|
||||
;;
|
||||
[Xx]*)
|
||||
echo -e "\n${cyan}---exiting---\n${norm}"
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
# check IP for validity
|
||||
if [[ "${inputIP}" =~ ^${regexIP4}$ ]]; then
|
||||
IP4="${inputIP}"
|
||||
break
|
||||
else
|
||||
echo -e "\n${err}Invalid IP4 format (xxx.xxx.xxx.xxx)${norm}"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
Loading…
Reference in New Issue
Block a user