add new config option for the hostname in /etc/config/system (fixes #1302, #1438)
authorFelix Fietkau <nbd@openwrt.org>
Tue, 6 Mar 2007 21:28:57 +0000 (21:28 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 6 Mar 2007 21:28:57 +0000 (21:28 +0000)
SVN-Revision: 6532

package/base-files/files/etc/config/system [new file with mode: 0644]
package/base-files/files/etc/init.d/boot

diff --git a/package/base-files/files/etc/config/system b/package/base-files/files/etc/config/system
new file mode 100644 (file)
index 0000000..204a73a
--- /dev/null
@@ -0,0 +1,2 @@
+config system
+       option hostname OpenWrt
index ed5e7d8ba56772a0a220bbbe747cd9cf28ec5115..c644b2fec2d9ccf0c817fffbcc0eea84e65df08c 100755 (executable)
@@ -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