aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2012-09-27 17:51:51 (GMT)
committerTom Gundersen <teg@jklm.no>2012-09-27 17:51:51 (GMT)
commita9ffc483b60f481bf4a8ba858f1c18f7b64bd5ad (patch)
tree4d926b2211f223bcd850cb809efc8cdd08b2d31a
parentc67d598d1cb2c346c83b72449bf20ee5dfea9ae7 (diff)
downloadinitscripts-2012.09.1.tar.xz
hostname: set very early2012.09.1
Also properly check for the deprecated use of rc.conf for this purpose, as we were getting lots of false positives. Signed-off-by: Tom Gundersen <teg@jklm.no>
-rwxr-xr-xrc.sysinit23
1 files changed, 12 insertions, 11 deletions
diff --git a/rc.sysinit b/rc.sysinit
index b285cc7..458bac6 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -3,9 +3,21 @@
# /etc/rc.sysinit
#
+unset HOSTNAME
+
. /etc/rc.conf
. /etc/rc.d/functions
+if [[ $HOSTNAME ]]; then
+ print_depr "HOSTNAME=" "rc.conf(5) and hostname(5)"
+fi
+if [[ -s /etc/hostname ]]; then
+ HOSTNAME=$(< /etc/hostname)
+fi
+if [[ $HOSTNAME ]]; then
+ echo "$HOSTNAME" >| /proc/sys/kernel/hostname
+fi
+
# don't let all the systemd tools be too verbose
export SYSTEMD_LOG_LEVEL="notice"
@@ -137,17 +149,6 @@ status 'Initializing random seed' /usr/lib/systemd/systemd-random-seed load
# Remove leftover files
remove_leftover
-if [[ $HOSTNAME ]]; then
- print_depr "HOSTNAME=" "rc.conf(5) and hostname(5)"
-fi
-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
-fi
-
stat_busy "Saving dmesg log"
if [[ -e /proc/sys/kernel/dmesg_restrict ]] &&
(( $(< /proc/sys/kernel/dmesg_restrict) == 1 )); then