aboutsummaryrefslogtreecommitdiff
path: root/rc.sysinit
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2011-10-19 08:06:35 (GMT)
committerTom Gundersen <teg@jklm.no>2011-12-27 15:01:22 (GMT)
commit0724c1d8aa760f02190c7ee325274f0d0957943e (patch)
tree5bb5e4193ffbd52974ad0689dcc4f2e38f9978ec /rc.sysinit
parentb4ef9040c72235d2e863dcd6b699c08f9b1a0cce (diff)
downloadinitscripts-0724c1d8aa760f02190c7ee325274f0d0957943e.tar.xz
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 <teg@jklm.no>
Diffstat (limited to 'rc.sysinit')
-rwxr-xr-xrc.sysinit3
1 files changed, 3 insertions, 0 deletions
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