init.d/hostname: do not use localhost as a default hostname

This allows the operating system default hostname to be used if no
hostname is configured.
This commit is contained in:
William Hubbs 2016-08-24 13:43:11 -05:00
parent 353bb9bc9a
commit 4018dfc8de

View File

@ -24,7 +24,11 @@ start()
else
# HOSTNAME variable used to be defined in caps in conf.d/hostname.
# It is also a magic variable in bash.
h=${hostname-${HOSTNAME-localhost}} # checkbashisms: false positive
h=${hostname-${HOSTNAME}} # checkbashisms: false positive
fi
if [ -z "$h" ]; then
einfo "Using default system hostname"
return 0
fi
ebegin "Setting hostname to $h $source"
hostname "$h"