]> git.enpas.org Git - openwrt.git/blobdiff - package/base-files/files/etc/init.d/boot
base-files: move uci_apply_defaults() to /etc/init.d/boot
[openwrt.git] / package / base-files / files / etc / init.d / boot
index ffcc9f7adf27c3f6d44f52bc98027090bdd9582b..b44c1a69fe15fee71e3cdb2871e9efa4dab53241 100755 (executable)
@@ -4,35 +4,15 @@
 START=10
 STOP=98
 
-system_config() {
-       local cfg="$1"
-
-       local hostname conloglevel buffersize timezone zonename
-
-       config_get hostname "$cfg" hostname 'OpenWrt'
-       echo "$hostname" > /proc/sys/kernel/hostname
-
-       config_get conloglevel "$cfg" conloglevel
-       config_get buffersize "$cfg" buffersize
-       [ -z "$conloglevel" -a -z "$buffersize" ] || dmesg ${conloglevel:+-n $conloglevel} ${buffersize:+-s $buffersize}
-
-       config_get timezone "$cfg" timezone 'UTC'
-       echo "$timezone" > /tmp/TZ
-
-       config_get zonename "$cfg" zonename
-       [ -n "$zonename" ] && [ -f "/usr/share/zoneinfo/$zonename" ] && ln -s "/usr/share/zoneinfo/$zonename" /tmp/localtime
-
-       # apply timezone to kernel
-       date -k
-}
-
-apply_uci_config() {
-       sh -c '. /lib/functions.sh; include /lib/config; uci_apply_defaults'
-}
-
-start() {
-       config_load system
-       config_foreach system_config system
+uci_apply_defaults() {
+       cd /etc/uci-defaults || return 0
+       files="$(ls)"
+       [ -z "$files" ] && return 0
+       mkdir -p /tmp/.uci
+       for file in $files; do
+               ( . "./$(basename $file)" ) && rm -f "$file"
+       done
+       uci commit
 }
 
 boot() {
@@ -50,7 +30,7 @@ boot() {
        touch /var/log/lastlog
        touch /tmp/resolv.conf.auto
        ln -sf /tmp/resolv.conf.auto /tmp/resolv.conf
-       grep -q debugfs /proc/filesystems && mount -o noatime -t debugfs debugfs /sys/kernel/debug
+       grep -q debugfs /proc/filesystems && /bin/mount -o noatime -t debugfs debugfs /sys/kernel/debug
        [ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe
 
        /sbin/kmodloader
@@ -64,7 +44,7 @@ boot() {
        }
        rm -f /tmp/wireless.tmp
 
-       apply_uci_config
+       uci_apply_defaults
        
        # temporary hack until configd exists
        /sbin/reload_config