From 0724c1d8aa760f02190c7ee325274f0d0957943e Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Wed, 19 Oct 2011 10:06:35 +0200 Subject: config: add /etc/hostname support If /etc/hostname is non-empty its contents is assumed to be the hostname. This takes precedence over HOSTNAME in rc.conf. This implements FS#27732 and http://0pointer.de/public/systemd-man/hostname.html, and is the same as what is done on Debian, Ubuntu, Fedora and Suse. Signed-off-by: Tom Gundersen --- rc.sysinit | 3 +++ 1 file changed, 3 insertions(+) (limited to 'rc.sysinit') diff --git a/rc.sysinit b/rc.sysinit index 8dd1607..602ef1f 100755 --- a/rc.sysinit +++ b/rc.sysinit @@ -225,6 +225,9 @@ RANDOM_SEED=/var/lib/misc/random-seed # Remove leftover files remove_leftover +if [[ -s /etc/hostname ]]; then + HOSTNAME=$(< /etc/hostname) +fi if [[ $HOSTNAME ]]; then stat_busy "Setting Hostname: $HOSTNAME" echo "$HOSTNAME" >| /proc/sys/kernel/hostname && stat_done || stat_fail -- cgit v1.2.3