b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | #!/bin/sh /etc/rc.common |
| 2 | # Copyright (C) 2006-2011 OpenWrt.org |
| 3 | |
| 4 | START=10 |
| 5 | STOP=90 |
| 6 | |
hj.shao | 13c49a6 | 2025-07-31 01:01:24 -0700 | [diff] [blame^] | 7 | PRODMODE=`uci get cmdline.PROD 2> /dev/null` |
| 8 | RDUPMODE=`uci get cmdline.RDUP 2> /dev/null` |
| 9 | |
b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 10 | uci_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 | |
| 22 | boot() { |
| 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.liu | b17525e | 2025-05-14 17:22:29 +0800 | [diff] [blame] | 31 | # Add by mbtk |
| 32 | mkdir -p /var/run/faillock |
b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 33 | 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.shao | 13c49a6 | 2025-07-31 01:01:24 -0700 | [diff] [blame^] | 61 | |
| 62 | if [ "$PRODMODE" == "0" ] && [ "$RDUPMODE" == "1" ];then |
| 63 | nice -n -5 /bin/diag & |
| 64 | fi |
| 65 | |
b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 66 | # 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 | } |