Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/openrc:master commit in: init.d/
Date: Wed, 24 Aug 2016 18:49:17
Message-Id: 1471976539.353bb9bc9a0ab3c6650d72d2ceb14c990762a2a0.williamh@OpenRC
1 commit: 353bb9bc9a0ab3c6650d72d2ceb14c990762a2a0
2 Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
3 AuthorDate: Tue Aug 23 18:22:19 2016 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Tue Aug 23 18:22:19 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=353bb9bc
7
8 init.d/hostname: add support for /etc/hostname
9
10 init.d/hostname.in | 16 +++++++++++-----
11 1 file changed, 11 insertions(+), 5 deletions(-)
12
13 diff --git a/init.d/hostname.in b/init.d/hostname.in
14 index 21ed701..74866b4 100644
15 --- a/init.d/hostname.in
16 +++ b/init.d/hostname.in
17 @@ -17,10 +17,16 @@ depend() {
18
19 start()
20 {
21 - # HOSTNAME variable used to be defined in caps in conf.d/hostname.
22 - # It is also a magic variable in bash.
23 - hostname=${hostname-${HOSTNAME-localhost}} # checkbashisms: false positive
24 - ebegin "Setting hostname to $hostname"
25 - hostname "$hostname"
26 + local h source x
27 + if [ -s @SYSCONFDIR@/hostname ] && [ -r @SYSCONFDIR@/hostname ]; then
28 + read h x <@SYSCONFDIR@/hostname
29 + source=" from @SYSCONFDIR@/hostname"
30 + else
31 + # HOSTNAME variable used to be defined in caps in conf.d/hostname.
32 + # It is also a magic variable in bash.
33 + h=${hostname-${HOSTNAME-localhost}} # checkbashisms: false positive
34 + fi
35 + ebegin "Setting hostname to $h $source"
36 + hostname "$h"
37 eend $? "Failed to set the hostname"
38 }