Always set the transient hostname.
Fix hostname setting for Debian or other distros where hostnamectl does
not work.
@@ -40,10 +40,9 @@ if [ -n "$new_host_name" ]; then
hostnamectl=$( which hostnamectl 2> /dev/null )
if [ -x "$hostnamectl" ]; then
$hostnamectl set-hostname "$new_host_name"
- else
- # Assume hostname command exists.
- hostname "${new_host_name%%.*}"
fi
+ # Also set the transient hostname.
+ hostname "${new_host_name%%.*}"
# If NetworkManager is installed set the hostname with nmcli.
# to resolve issues with NetworkManager resetting the hostname
