oxnas.sh 834 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/sh
  2. #
  3. # Copyright (C) 2013 OpenWrt.org
  4. #
  5. OXNAS_BOARD_NAME=
  6. OXNAS_MODEL=
  7. oxnas_board_detect() {
  8. local machine
  9. local name
  10. machine=$(cat /proc/device-tree/model)
  11. case "$machine" in
  12. *"MitraStar Technology Corp. STG-212"*)
  13. name="stg212"
  14. ;;
  15. *"Shuttle KD20"*)
  16. name="kd20"
  17. ;;
  18. *"Pogoplug Pro"*)
  19. name="pogoplugpro"
  20. ;;
  21. *"Pogoplug V3"*)
  22. name="pogoplugv3"
  23. ;;
  24. esac
  25. [ -z "$name" ] && name="unknown"
  26. [ -z "$OXNAS_BOARD_NAME" ] && OXNAS_BOARD_NAME="$name"
  27. [ -z "$OXNAS_MODEL" ] && OXNAS_MODEL="$machine"
  28. [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
  29. echo "$OXNAS_BOARD_NAME" > /tmp/sysinfo/board_name
  30. echo "$OXNAS_MODEL" > /tmp/sysinfo/model
  31. }
  32. oxnas_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. }