Script updated

This commit is contained in:
Fr4nz D13trich 2025-10-10 13:28:40 +02:00
parent eed441b0d6
commit d3df81c908
3 changed files with 7 additions and 9 deletions

View file

@ -48,9 +48,7 @@ fi
###### HOST
onif=$(/sbin/ip route get 162.249.72.1 | awk '{print $5}' | cut -d/ -f1)
ip4=$(/sbin/ip -o -4 addr list "$onif" | awk '{print $4}' | cut -d/ -f1)
############################# add interface fail safe
onif=$(/sbin/ip route get 162.249.72.1 | awk '{print $5}' | cut -d/ -f1) ### GET ACTIVE NETWORK INTERFACE
while true; do
echo -e " ${YEL}What network interface will nginx be using?${CRS}"
@ -58,18 +56,19 @@ while true; do
if ! [ "$nif" ]; then
nif="$onif"
break
elif [ ]; then # JEFF check in /sys/class/net/
elif [ -d "/sys/class/net/$nif" ]; then
break
else
echo -e "\n ${LRD}Interface not found... Try again!${CRS}\n"
fi
done
ip4=$(/sbin/ip -o -4 addr list "$nif" | awk '{print $4}' | cut -d/ -f1) ### GET IP FOR CHOSEN INTERFACE
echo -e "\n ${YEL}Current hostname : ${LCY}$HOSTNAME${CRS}"
echo -e " ${YEL}Current ip address : ${LCY}$ip4${CRS}"
echo -e " ${YEL}Current ip address : ${LCY}$ip4 ${YEL}@ ${LCY}$nif${CRS}"
echo -e "\n ${YEL}This information will be used to configure ${LCY}nginx.conf ${YEL}during the next steps.${CRS}"
while true; do
read -p " Would you like to change the hostname? (y/N) --> " conf_hostname
if [[ "$conf_hostname" = "" || "$conf_hostname" = "n" || "$conf_hostname" = "N" ]]; then
new_hostname=$HOSTNAME
@ -83,7 +82,6 @@ while true; do
else
echo -e "\n ${YEL}Invalid response... Try again...\n\n Y = (Yes, set new hostname)\n N = (No, leave as is)${CRS}\n "
fi
done
###### CERTIFICATION