commit: 4018dfc8de4818101c336ff8bcf0f4762b318c6a
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Wed Aug 24 18:43:11 2016 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Aug 24 18:43:11 2016 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=4018dfc8
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 74866b4..253d338 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"