blob: 36724d1a2b1a37c972bf0b504710bd46497ff2f1 [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
hj.shao13c49a62025-07-31 01:01:24 -07007PRODMODE=`uci get cmdline.PROD 2> /dev/null`
8RDUPMODE=`uci get cmdline.RDUP 2> /dev/null`
9
b.liue9582032025-04-17 19:18:16 +080010uci_apply_defaults() {
11 . /lib/functions/system.sh
12
13 cd /etc/uci-defaults || return 0
14 files="$(ls)"
15 [ -z "$files" ] && return 0
16 for file in $files; do
17 ( . "./$(basename $file)" ) && rm -f "$file"
18 done
19 uci commit
20}
21
22boot() {
23 [ -f /proc/mounts ] || /sbin/mount_root
24 [ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc
25 [ -f /proc/net/vlan/config ] && vconfig set_name_type DEV_PLUS_VID_NO_PAD
26
27 mkdir -p /var/lock
28 chmod 1777 /var/lock
29 mkdir -p /var/log
30 mkdir -p /var/run
b.liub17525e2025-05-14 17:22:29 +080031 # Add by mbtk
32 mkdir -p /var/run/faillock
b.liue9582032025-04-17 19:18:16 +080033 ln -s /var/run /run
34 ln -s /var/lock /run/lock
35 mkdir -p /var/state
36 mkdir -p /var/tmp
37 mkdir -p /var/camera
38 mkdir -p /tmp/.uci
39 chmod 0700 /tmp/.uci
40 echo 0 > /tmp/dBm
41 touch /var/log/wtmp
42 touch /var/log/lastlog
43 mkdir -p /tmp/resolv.conf.d
44 touch /tmp/resolv.conf.d/resolv.conf.auto
45 ln -sf /tmp/resolv.conf.d/resolv.conf.auto /tmp/resolv.conf
46 grep -q debugfs /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime -t debugfs debugfs /sys/kernel/debug
47 grep -q bpf /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime,mode=0700 -t bpf bpffs /sys/fs/bpf
48 grep -q pstore /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime -t pstore pstore /sys/fs/pstore
49 [ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe
50
51 touch /tmp/.config_pending
52 /bin/pppmodem &
53
54 mkdir -p /tmp/.uci
55 [ -f /etc/uci-defaults/30_uboot-envtools ] && (. /etc/uci-defaults/30_uboot-envtools)
56 /bin/config_generate
57 rm -f /tmp/.config_pending
58 /sbin/wifi config
59 uci_apply_defaults
60 sync
hj.shao13c49a62025-07-31 01:01:24 -070061
62 if [ "$PRODMODE" == "0" ] && [ "$RDUPMODE" == "1" ];then
63 nice -n -5 /bin/diag &
64 fi
65
b.liue9582032025-04-17 19:18:16 +080066 # temporary hack until configd exists
67 /sbin/reload_config
68
69 # let mount done early to boot telephony success
70 [ -d /tmp/root ] && mount_root done
71}