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 | |
| 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 | for file in $files; do |
| 14 | ( . "./$(basename $file)" ) && rm -f "$file" |
| 15 | done |
| 16 | uci commit |
| 17 | } |
| 18 | |
| 19 | boot() { |
| 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 |
| 28 | ln -s /var/run /run |
| 29 | ln -s /var/lock /run/lock |
| 30 | mkdir -p /var/state |
| 31 | mkdir -p /var/tmp |
| 32 | mkdir -p /var/camera |
| 33 | mkdir -p /tmp/.uci |
| 34 | chmod 0700 /tmp/.uci |
| 35 | echo 0 > /tmp/dBm |
| 36 | touch /var/log/wtmp |
| 37 | touch /var/log/lastlog |
| 38 | mkdir -p /tmp/resolv.conf.d |
| 39 | touch /tmp/resolv.conf.d/resolv.conf.auto |
| 40 | ln -sf /tmp/resolv.conf.d/resolv.conf.auto /tmp/resolv.conf |
| 41 | grep -q debugfs /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime -t debugfs debugfs /sys/kernel/debug |
| 42 | grep -q bpf /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime,mode=0700 -t bpf bpffs /sys/fs/bpf |
| 43 | grep -q pstore /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime -t pstore pstore /sys/fs/pstore |
| 44 | [ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe |
| 45 | |
| 46 | touch /tmp/.config_pending |
| 47 | /bin/pppmodem & |
| 48 | |
| 49 | mkdir -p /tmp/.uci |
| 50 | [ -f /etc/uci-defaults/30_uboot-envtools ] && (. /etc/uci-defaults/30_uboot-envtools) |
| 51 | /bin/config_generate |
| 52 | rm -f /tmp/.config_pending |
| 53 | /sbin/wifi config |
| 54 | uci_apply_defaults |
| 55 | sync |
| 56 | |
| 57 | # temporary hack until configd exists |
| 58 | /sbin/reload_config |
| 59 | |
| 60 | # let mount done early to boot telephony success |
| 61 | [ -d /tmp/root ] && mount_root done |
| 62 | } |