Browse Source

new: [0km] add consistency check to ``vps-setup`` for content of ``/etc/hostname`` and output of ``hostname``

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
rc1
Valentin Lab 3 years ago
parent
commit
e19ad5163b
  1. 12
      bin/0km

12
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

Loading…
Cancel
Save