diff --git a/assets/test/test.sh b/assets/test/test.sh index fa7d691..c8926cd 100755 --- a/assets/test/test.sh +++ b/assets/test/test.sh @@ -1,7 +1,5 @@ #!/bin/bash -sudo sed -i.backup "s/$HOSTNAME/xXxXx/g" /etc/hosts -sudo sed -i.backup "s/$HOSTNAME/xXxXx/g" /etc/hostname -sudo systemctl reload NetworkManager -#sudo systemctl restart NetworkManager +sudo hostnamectl set-hostname testthree +sudo systemctl restart NetworkManager echo "$hostname" \ No newline at end of file diff --git a/dev_env_setup.sh b/dev_env_setup.sh index 27434d5..cd1e209 100755 --- a/dev_env_setup.sh +++ b/dev_env_setup.sh @@ -63,7 +63,7 @@ while true; do fi done -ip4=$(/sbin/ip -o -4 addr list "$nif" | awk '{print $4}' | cut -d/ -f1) ### GET IP FOR CHOSEN INTERFACE +ip4=$(/sbin/ip -o -4 addr list "$nif" | awk '{print $4}' | cut -d/ -f1) ### GET IP FOR CHOSEN INTERFACE ########## HOSTNAME TROUBLE! fix it echo -e "\n ${YEL}Current hostname : ${LCY}$HOSTNAME${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}" @@ -77,9 +77,8 @@ while true; do read -p " Enter new hostname --> " new_hostname sudo sed -i.backup "s/$HOSTNAME/$new_hostname/g" /etc/hosts sudo sed -i.backup "s/$HOSTNAME/$new_hostname/g" /etc/hostname - sleep 3s sudo systemctl reload NetworkManager - echo -e "\n ${GRN}Host name changed to ${LCY}$new_hostname${CRS}" + echo -e "\n ${GRN}Host name changed to ${LCY}$(hostname)${CRS}" break else echo -e "\n ${YEL}Invalid response... Try again...\n\n Y = (Yes, set new hostname)\n N = (No, leave as is)${CRS}\n " @@ -103,9 +102,9 @@ while true; do : fi echo -e " ${YEL}Enter file name for certificate and key${CRS}" - read -p " default = $HOSTNAME --> " cert_name + read -p " default = $(hostname) --> " cert_name if ! [ "$cert_name" ]; then - cert_name=$HOSTNAME + cert_name=$(hostname) else : fi