From d3df81c90875c32ce5cca922165911abce7381c2 Mon Sep 17 00:00:00 2001 From: Fr4nzD13trich Date: Fri, 10 Oct 2025 13:28:40 +0200 Subject: [PATCH] Script updated --- assets/test/hostname.backup | 2 +- assets/test/hosts.backup | 2 +- dev_env_setup.sh | 12 +++++------- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/assets/test/hostname.backup b/assets/test/hostname.backup index ebf0746..a7f8d9e 100644 --- a/assets/test/hostname.backup +++ b/assets/test/hostname.backup @@ -1 +1 @@ -cor3unit +bla diff --git a/assets/test/hosts.backup b/assets/test/hosts.backup index e33848e..06ea628 100644 --- a/assets/test/hosts.backup +++ b/assets/test/hosts.backup @@ -1,5 +1,5 @@ 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 ::1 localhost ip6-localhost ip6-loopback diff --git a/dev_env_setup.sh b/dev_env_setup.sh index 066b270..b25bafd 100755 --- a/dev_env_setup.sh +++ b/dev_env_setup.sh @@ -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