Prompt reboot after hostname change
This commit is contained in:
@@ -264,7 +264,7 @@ write_resolv_conf() {
|
||||
|
||||
# Orchestre la collecte des informations, la confirmation et l'application des changements.
|
||||
main() {
|
||||
local hostname interface ip_cidr gateway dns_servers restart_answer network_changed
|
||||
local hostname interface ip_cidr gateway dns_servers reboot_answer restart_answer network_changed
|
||||
|
||||
echo "Configuration reseau Debian"
|
||||
echo
|
||||
@@ -347,6 +347,17 @@ main() {
|
||||
echo "Redemarrez le reseau ou la machine pour appliquer la configuration IP."
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -n "${hostname}" ]]; then
|
||||
echo
|
||||
read -r -p "Redemarrer la machine maintenant pour appliquer completement le hostname ? [y/N]: " reboot_answer
|
||||
if [[ "${reboot_answer}" =~ ^[yY]$ ]]; then
|
||||
echo "Redemarrage de la machine."
|
||||
systemctl reboot
|
||||
else
|
||||
echo "Redemarrez la machine plus tard pour que le nouveau hostname soit pris en compte partout."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
Reference in New Issue
Block a user