[arch-projects] [PATCH 1/7] config: add /etc/hostname support

Tom Gundersen teg at jklm.no
Wed Oct 26 19:38:27 EDT 2011


If /etc/hostname is non-empty its contents is assumed to be the hostname.
This takes precedence over HOSTNAME in rc.conf.

Signed-off-by: Tom Gundersen <teg at jklm.no>
---
 rc.sysinit |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/rc.sysinit b/rc.sysinit
index dffea4d..3e5fec9 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -232,6 +232,9 @@ RANDOM_SEED=/var/lib/misc/random-seed
 # Remove leftover files
 remove_leftover
 
+if [[ -s /etc/hostname ]]; then
+	HOSTNAME=$(cat /etc/hostname)
+fi
 if [[ $HOSTNAME ]]; then
 	stat_busy "Setting Hostname: $HOSTNAME"
 	echo "$HOSTNAME" >| /proc/sys/kernel/hostname && stat_done || stat_fail
-- 
1.7.7.1



More information about the arch-projects mailing list