base-files: fix /tmp/.jail permissions
[openwrt/openwrt.git] / package / base-files / files / etc / init.d / boot
index 8b5455d8bcdfa738d71a529ddc26f148a1e7417e..a53be743e8872b67ad6d4fff64565ef34009dab8 100755 (executable)
@@ -4,35 +4,17 @@
 START=10
 STOP=98
 
-system_config() {
-       local cfg="$1"
+uci_apply_defaults() {
+       . /lib/functions/system.sh
 
-       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
+       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() {
@@ -46,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
@@ -64,13 +47,12 @@ boot() {
        }
        rm -f /tmp/wireless.tmp
 
-       apply_uci_config
+       /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)