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

@ -1 +1 @@
cor3unit bla

View file

@ -1,5 +1,5 @@
127.0.0.1 localhost 127.0.0.1 localhost
127.0.1.1 cor3unit.lan cor3unit 127.0.1.1 bla.lan bla
# The following lines are desirable for IPv6 capable hosts # The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback ::1 localhost ip6-localhost ip6-loopback

View file

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