mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-13 02:24:27 +05:00
fix: add missing function call and simplify function to set hostname
This commit is contained in:
@@ -178,11 +178,7 @@ set_hostname(){
|
||||
sudo hostnamectl set-hostname "$NEW_HOSTNAME"
|
||||
#write new hostname to /etc/hosts
|
||||
status_msg "Writing new hostname to /etc/hosts ..."
|
||||
if cat /etc/hosts | grep "###set by kiauh" &>/dev/null; then
|
||||
sudo sed -i "/###set by kiauh/s/\<$HOSTNAME\>/$NEW_HOSTNAME/" /etc/hosts
|
||||
else
|
||||
echo "127.0.0.1 $NEW_HOSTNAME ###set by kiauh" | sudo tee -a /etc/hosts &>/dev/null
|
||||
fi
|
||||
echo "127.0.0.1 $NEW_HOSTNAME" | sudo tee -a /etc/hosts &>/dev/null
|
||||
ok_msg "New hostname successfully configured!"
|
||||
ok_msg "Remember to reboot for the changes to take effect!"
|
||||
fi
|
||||
|
||||
@@ -73,7 +73,7 @@ advanced_menu(){
|
||||
6)
|
||||
clear
|
||||
print_header
|
||||
create_custom_hostname
|
||||
create_custom_hostname && set_hostname
|
||||
print_msg && clear_msg
|
||||
advanced_ui;;
|
||||
7)
|
||||
|
||||
Reference in New Issue
Block a user