boot 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2006-2011 OpenWrt.org
  3. START=10
  4. STOP=90
  5. uci_apply_defaults() {
  6. . /lib/functions/system.sh
  7. cd /etc/uci-defaults || return 0
  8. files="$(ls)"
  9. [ -z "$files" ] && return 0
  10. mkdir -p /tmp/.uci
  11. for file in $files; do
  12. ( . "./$(basename $file)" ) && rm -f "$file"
  13. done
  14. uci commit
  15. }
  16. boot() {
  17. [ -f /proc/mounts ] || /sbin/mount_root
  18. [ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc
  19. mkdir -p /var/lock
  20. chmod 1777 /var/lock
  21. mkdir -p /var/log
  22. mkdir -p /var/run
  23. mkdir -p /var/state
  24. mkdir -p /var/tmp
  25. mkdir -p /tmp/.uci
  26. chmod 0700 /tmp/.uci
  27. touch /var/log/wtmp
  28. touch /var/log/lastlog
  29. mkdir -p /tmp/resolv.conf.d
  30. touch /tmp/resolv.conf.d/resolv.conf.auto
  31. ln -sf /tmp/resolv.conf.d/resolv.conf.auto /tmp/resolv.conf
  32. grep -q debugfs /proc/filesystems && /bin/mount -o noatime -t debugfs debugfs /sys/kernel/debug
  33. grep -q bpf /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime,mode=0700 -t bpf bpffs /sys/fs/bpf
  34. grep -q pstore /proc/filesystems && /bin/mount -o noatime -t pstore pstore /sys/fs/pstore
  35. [ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe
  36. /sbin/kmodloader
  37. [ ! -f /etc/config/wireless ] && {
  38. # compat for bcm47xx and mvebu
  39. sleep 1
  40. }
  41. /bin/config_generate
  42. uci_apply_defaults
  43. sync
  44. # temporary hack until configd exists
  45. /sbin/reload_config
  46. }