add new config option for the hostname in /etc/config/system (fixes #1302, #1438)

SVN-Revision: 6532
This commit is contained in:
Felix Fietkau 2007-03-06 21:28:57 +00:00
parent 18b744818a
commit b77680287e
2 changed files with 13 additions and 2 deletions

View file

@ -0,0 +1,2 @@
config system
option hostname OpenWrt

View file

@ -2,13 +2,22 @@
# Copyright (C) 2006 OpenWrt.org
START=10
system_config() {
local cfg="$1"
local hostname
config_get hostname "$cfg" hostname
echo "${hostname:-OpenWrt}" > /proc/sys/kernel/hostname
}
start() {
[ -f /proc/mounts ] || /sbin/mount_root
[ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc
vconfig set_name_type DEV_PLUS_VID_NO_PAD
HOSTNAME=${wan_hostname%%.*}
echo ${HOSTNAME:=OpenWrt}>/proc/sys/kernel/hostname
config_load system
config_foreach system_config system
mkdir -p /var/run
mkdir -p /var/log