e1c60c1c2fac50ebcfda4c09c4bf7cf4e844ab6c
[openwrt/staging/wigyori.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/lock
25 chmod 1777 /var/lock
26 mkdir -p /var/log
27 mkdir -p /var/run
28 mkdir -p /var/state
29 mkdir -p /var/tmp
30 mkdir -p /tmp/.uci
31 chmod 0700 /tmp/.uci
32 touch /var/log/wtmp
33 touch /var/log/lastlog
34 mkdir -p /tmp/resolv.conf.d
35 touch /tmp/resolv.conf.d/resolv.conf.auto
36 ln -sf /tmp/resolv.conf.d/resolv.conf.auto /tmp/resolv.conf
37 grep -q debugfs /proc/filesystems && /bin/mount -o noatime -t debugfs debugfs /sys/kernel/debug
38 grep -q bpf /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime,mode=0700 -t bpf bpffs /sys/fs/bpf
39 grep -q pstore /proc/filesystems && /bin/mount -o noatime -t pstore pstore /sys/fs/pstore
40 [ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe
41
42 /sbin/kmodloader
43
44 [ ! -f /etc/config/wireless ] && {
45 # compat for bcm47xx and mvebu
46 sleep 1
47 }
48
49 /bin/config_generate
50 uci_apply_defaults
51
52 # temporary hack until configd exists
53 /sbin/reload_config
54 }