14 lines
360 B
Bash
Executable file
14 lines
360 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
old_hostname="${HOSTNAME}";
|
|
new_hostname="$(ask_text "Set system hostname" "Enter this system's new hostname:" "")";
|
|
|
|
task_begin "Updating hostname to ${new_hostname}";
|
|
|
|
hostname "${new_hostname}";
|
|
|
|
cp /etc/hosts /etc/hosts.bak;
|
|
|
|
sed "0,/${old_hostname}/{s/${old_hostname}/${new_hostname}/g}" /etc/hosts.bak >/etc/hosts;
|
|
|
|
task_end "${?}";
|