apm821xx.sh 904 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/sh
  2. APM821XX_BOARD_NAME=
  3. APM821XX_MODEL=
  4. apm821xx_board_detect() {
  5. local model
  6. local name
  7. model=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /model/ {print $2}' /proc/cpuinfo)
  8. case "$model" in
  9. *"Meraki MR24 Access Point")
  10. name="mr24"
  11. ;;
  12. *"Meraki MX60/MX60W Security Appliance")
  13. name="mx60"
  14. ;;
  15. *"MyBook Live"*)
  16. name="mbl"
  17. ;;
  18. *"Netgear WNDR4700/WNDR4720 Series")
  19. name="wndr4700"
  20. ;;
  21. *)
  22. name="unknown"
  23. ;;
  24. esac
  25. [ -z "$name" ] && name="unknown"
  26. [ -z "$APM821XX_BOARD_NAME" ] && APM821XX_BOARD_NAME="$name"
  27. [ -z "$APM821XX_MODEL" ] && APM821XX_MODEL="$model"
  28. [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
  29. echo "$APM821XX_BOARD_NAME" > /tmp/sysinfo/board_name
  30. echo "$APM821XX_MODEL" > /tmp/sysinfo/model
  31. }
  32. apm821xx_board_name() {
  33. local name
  34. [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
  35. [ -z "$name" ] && name="unknown"
  36. echo "$name"
  37. }