base-files: fix /tmp/.jail permissions
[openwrt/openwrt.git] / package / base-files / files / etc / init.d / boot
index 45cb4a2596812adf81173ecea9a0d70e79148cae..a53be743e8872b67ad6d4fff64565ef34009dab8 100755 (executable)
@@ -4,6 +4,19 @@
 START=10
 STOP=98
 
+uci_apply_defaults() {
+       . /lib/functions/system.sh
+
+       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() {
        [ -f /proc/mounts ] || /sbin/mount_root
        [ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc
@@ -15,6 +28,7 @@ boot() {
        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
@@ -33,13 +47,12 @@ boot() {
        }
        rm -f /tmp/wireless.tmp
 
-       sh -c '. /lib/functions.sh; include /lib/config; uci_apply_defaults'
+       /bin/board_detect
+       uci_apply_defaults
        
        # temporary hack until configd exists
        /sbin/reload_config
 
-       start
-
        # create /dev/root if it doesn't exist
        [ -e /dev/root -o -h /dev/root ] || {
                rootdev=$(awk 'BEGIN { RS=" "; FS="="; } $1 == "root" { print $2 }' < /proc/cmdline)