1 |
commit: 4018dfc8de4818101c336ff8bcf0f4762b318c6a |
2 |
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com> |
3 |
AuthorDate: Wed Aug 24 18:43:11 2016 +0000 |
4 |
Commit: William Hubbs <williamh <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Aug 24 18:43:11 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=4018dfc8 |
7 |
|
8 |
init.d/hostname: do not use localhost as a default hostname |
9 |
|
10 |
This allows the operating system default hostname to be used if no |
11 |
hostname is configured. |
12 |
|
13 |
init.d/hostname.in | 6 +++++- |
14 |
1 file changed, 5 insertions(+), 1 deletion(-) |
15 |
|
16 |
diff --git a/init.d/hostname.in b/init.d/hostname.in |
17 |
index 74866b4..253d338 100644 |
18 |
--- a/init.d/hostname.in |
19 |
+++ b/init.d/hostname.in |
20 |
@@ -24,7 +24,11 @@ start() |
21 |
else |
22 |
# HOSTNAME variable used to be defined in caps in conf.d/hostname. |
23 |
# It is also a magic variable in bash. |
24 |
- h=${hostname-${HOSTNAME-localhost}} # checkbashisms: false positive |
25 |
+ h=${hostname-${HOSTNAME}} # checkbashisms: false positive |
26 |
+ fi |
27 |
+ if [ -z "$h" ]; then |
28 |
+ einfo "Using default system hostname" |
29 |
+ return 0 |
30 |
fi |
31 |
ebegin "Setting hostname to $h $source" |
32 |
hostname "$h" |