fstools: update to git HEAD
[openwrt/openwrt.git] / package / base-files / files / etc / init.d / boot
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2006-2011 OpenWrt.org
3
4 START=10
5 STOP=90
6
7 uci_apply_defaults() {
8 . /lib/functions/system.sh
9
10 cd /etc/uci-defaults || return 0
11 files="$(ls)"
12 [ -z "$files" ] && return 0
13 mkdir -p /tmp/.uci
14 for file in $files; do
15 ( . "./$(basename $file)" ) && rm -f "$file"
16 done
17 uci commit
18 }
19
20 boot() {
21 [ -f /proc/mounts ] || /sbin/mount_root
22 [ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc
23
24 mkdir -p /var/run
25 mkdir -p /var/log
26 mkdir -p /var/lock
27 mkdir -p /var/state
28 mkdir -p /var/tmp
29 mkdir -p /tmp/.uci
30 chmod 0700 /tmp/.uci
31 touch /var/log/wtmp
32 touch /var/log/lastlog
33 mkdir -p /tmp/resolv.conf.d
34 touch /tmp/resolv.conf.d/resolv.conf.auto
35 ln -sf /tmp/resolv.conf.d/resolv.conf.auto /tmp/resolv.conf
36 grep -q debugfs /proc/filesystems && /bin/mount -o noatime -t debugfs debugfs /sys/kernel/debug
37 grep -q bpf /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime,mode=0700 -t bpf bpffs /sys/fs/bpf
38 grep -q pstore /proc/filesystems && /bin/mount -o noatime -t pstore pstore /sys/fs/pstore
39 [ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe
40
41 /sbin/kmodloader
42
43 [ ! -f /etc/config/wireless ] && {
44 # compat for bcm47xx and mvebu
45 sleep 1
46 }
47
48 /bin/config_generate
49 uci_apply_defaults
50
51 # temporary hack until configd exists
52 /sbin/reload_config
53 }