diff --git a/bin/0km b/bin/0km index c5d0eb4..7f92c29 100755 --- a/bin/0km +++ b/bin/0km @@ -988,6 +988,18 @@ cmdline.spec::cmd:vps-setup:run() { print_status noop Feed fi + Elt "Checking consistency between /etc/hostname and \`hostname\`..." + etc_hostname="$(ssh:run "$host" -- $sudo_if_necessary cat /etc/hostname)" + transient_hostname="$(ssh:run "$host" -- $sudo_if_necessary hostname)" + if [ "$etc_hostname" != "$transient_hostname" ]; then + print_info "change" + ssh:run "$host" -- $sudo_if_necessary hostname "$etc_hostname" + Feedback || return 1 + else + print_info "consistent" + print_status noop + Feed + fi else info "Not changing domain as '$HOST' doesn't seem to be final domain." fi