base-files: fix /tmp/.jail permissions
[openwrt/openwrt.git] / package / base-files / files / etc / init.d / boot
index d33e8ce7f8120acba81d6ec1c8db8a519e4cd756..a53be743e8872b67ad6d4fff64565ef34009dab8 100755 (executable)
@@ -4,33 +4,20 @@
 START=10
 STOP=98
 
-system_config() {
-       local cfg="$1"
+uci_apply_defaults() {
+       . /lib/functions/system.sh
 
-       local hostname conloglevel timezone
-
-       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'
+       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
 }
 
-start() {
+boot() {
        [ -f /proc/mounts ] || /sbin/mount_root
        [ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc
        [ -f /proc/net/vlan/config ] && vconfig set_name_type DEV_PLUS_VID_NO_PAD
@@ -41,18 +28,15 @@ start() {
        mkdir -p /var/state
        mkdir -p /tmp/.uci
        chmod 0700 /tmp/.uci
+       mkdir -p /tmp/.jail
        touch /var/log/wtmp
        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
 
-       if [ -f /sbin/kmodloader ]; then
-               /sbin/kmodloader
-       else
-               load_modules /etc/modules.d/*
-       fi
+       /sbin/kmodloader
 
        # allow wifi modules time to settle
        sleep 1
@@ -63,9 +47,11 @@ start() {
        }
        rm -f /tmp/wireless.tmp
 
-       apply_uci_config
-       config_load system
-       config_foreach system_config system
+       /bin/board_detect
+       uci_apply_defaults
+       
+       # temporary hack until configd exists
+       /sbin/reload_config
 
        # create /dev/root if it doesn't exist
        [ -e /dev/root -o -h /dev/root ] || {