summaryrefslogtreecommitdiffstats
path: root/package/base-files
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-03-06 21:28:57 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-03-06 21:28:57 +0000
commite8311cb1713d32722d0a44f93a5678d96dbc1464 (patch)
tree083d5c8226bd264180291154aa14b147caaf482f /package/base-files
parentadd6fc7bdafc5542c872d7632a7b78e177200963 (diff)
add new config option for the hostname in /etc/config/system (fixes #1302, #1438)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@6532 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/base-files')
-rw-r--r--package/base-files/files/etc/config/system2
-rwxr-xr-xpackage/base-files/files/etc/init.d/boot13
2 files changed, 13 insertions, 2 deletions
diff --git a/package/base-files/files/etc/config/system b/package/base-files/files/etc/config/system
new file mode 100644
index 000000000..204a73a98
--- /dev/null
+++ b/package/base-files/files/etc/config/system
@@ -0,0 +1,2 @@
+config system
+ option hostname OpenWrt
diff --git a/package/base-files/files/etc/init.d/boot b/package/base-files/files/etc/init.d/boot
index ed5e7d8ba..c644b2fec 100755
--- a/package/base-files/files/etc/init.d/boot
+++ b/package/base-files/files/etc/init.d/boot
@@ -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