blob: b98e302ffcd05a2fbd009cadebafa1455b2bd2f2 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001#!/bin/sh /etc/rc.common
2# Copyright (C) 2006-2011 OpenWrt.org
3
4START=10
5STOP=90
6
7uci_apply_defaults() {
8 . /lib/functions/system.sh
9
10 cd /etc/uci-defaults || return 0
11 files="$(ls)"
12 [ -z "$files" ] && return 0
13 for file in $files; do
14 ( . "./$(basename $file)" ) && rm -f "$file"
15 done
16 uci commit
17}
18
19boot() {
20 [ -f /proc/mounts ] || /sbin/mount_root
21 [ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc
22 [ -f /proc/net/vlan/config ] && vconfig set_name_type DEV_PLUS_VID_NO_PAD
23
24 mkdir -p /var/lock
25 chmod 1777 /var/lock
26 mkdir -p /var/log
27 mkdir -p /var/run
b.liub17525e2025-05-14 17:22:29 +080028 # Add by mbtk
29 mkdir -p /var/run/faillock
b.liue9582032025-04-17 19:18:16 +080030 ln -s /var/run /run
31 ln -s /var/lock /run/lock
32 mkdir -p /var/state
33 mkdir -p /var/tmp
34 mkdir -p /var/camera
35 mkdir -p /tmp/.uci
36 chmod 0700 /tmp/.uci
37 echo 0 > /tmp/dBm
38 touch /var/log/wtmp
39 touch /var/log/lastlog
40 mkdir -p /tmp/resolv.conf.d
41 touch /tmp/resolv.conf.d/resolv.conf.auto
42 ln -sf /tmp/resolv.conf.d/resolv.conf.auto /tmp/resolv.conf
43 grep -q debugfs /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime -t debugfs debugfs /sys/kernel/debug
44 grep -q bpf /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime,mode=0700 -t bpf bpffs /sys/fs/bpf
45 grep -q pstore /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime -t pstore pstore /sys/fs/pstore
46 [ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe
47
48 touch /tmp/.config_pending
49 /bin/pppmodem &
50
51 mkdir -p /tmp/.uci
52 [ -f /etc/uci-defaults/30_uboot-envtools ] && (. /etc/uci-defaults/30_uboot-envtools)
53 /bin/config_generate
54 rm -f /tmp/.config_pending
55 /sbin/wifi config
56 uci_apply_defaults
57 sync
58
59 # temporary hack until configd exists
60 /sbin/reload_config
61
62 # let mount done early to boot telephony success
63 [ -d /tmp/root ] && mount_root done
64}