aboutsummaryrefslogtreecommitdiff
path: root/init.d
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2016-08-24 13:43:11 -0500
committerWilliam Hubbs <w.d.hubbs@gmail.com>2016-08-24 13:43:11 -0500
commit4018dfc8de4818101c336ff8bcf0f4762b318c6a (patch)
treebb579bd28f0a32bd4041e15899d7281194ebef62 /init.d
parent353bb9bc9a0ab3c6650d72d2ceb14c990762a2a0 (diff)
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.
Diffstat (limited to 'init.d')
-rw-r--r--init.d/hostname.in6
1 files changed, 5 insertions, 1 deletions
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"