From 4018dfc8de4818101c336ff8bcf0f4762b318c6a Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Wed, 24 Aug 2016 13:43:11 -0500 Subject: [PATCH] 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. --- init.d/hostname.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/init.d/hostname.in b/init.d/hostname.in index 74866b4c..253d338d 100644 --- a/init.d/hostname.in +++ b/init.d/hostname.in @@ -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"