final fixes

This commit is contained in:
Fr4nz D13trich 2025-10-10 20:11:17 +02:00
parent 4af3ec7276
commit cd0632281f
2 changed files with 6 additions and 9 deletions

View file

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
sudo sed -i.backup "s/$HOSTNAME/xXxXx/g" /etc/hosts sudo hostnamectl set-hostname testthree
sudo sed -i.backup "s/$HOSTNAME/xXxXx/g" /etc/hostname sudo systemctl restart NetworkManager
sudo systemctl reload NetworkManager
#sudo systemctl restart NetworkManager
echo "$hostname" echo "$hostname"

View file

@ -63,7 +63,7 @@ while true; do
fi fi
done 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 "\n ${YEL}Current hostname : ${LCY}$HOSTNAME${CRS}"
echo -e " ${YEL}Current ip address : ${LCY}$ip4 ${YEL}@ ${LCY}$nif${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}"
@ -77,9 +77,8 @@ while true; do
read -p " Enter new hostname --> " new_hostname 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/hosts
sudo sed -i.backup "s/$HOSTNAME/$new_hostname/g" /etc/hostname sudo sed -i.backup "s/$HOSTNAME/$new_hostname/g" /etc/hostname
sleep 3s
sudo systemctl reload NetworkManager 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 break
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 "
@ -103,9 +102,9 @@ while true; do
: :
fi fi
echo -e " ${YEL}Enter file name for certificate and key${CRS}" 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 if ! [ "$cert_name" ]; then
cert_name=$HOSTNAME cert_name=$(hostname)
else else
: :
fi fi