kirkwood.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #!/bin/sh
  2. #
  3. # Copyright (C) 2014 OpenWrt.org
  4. #
  5. KIRKWOOD_BOARD_NAME=
  6. KIRKWOOD_MODEL=
  7. kirkwood_board_detect() {
  8. local machine
  9. local name
  10. machine=$(cat /proc/device-tree/model)
  11. case "$machine" in
  12. "Seagate FreeAgent Dockstar")
  13. name="dockstar"
  14. ;;
  15. "Seagate GoFlex Home")
  16. name="goflexhome"
  17. ;;
  18. "Seagate GoFlex Net")
  19. name="goflexnet"
  20. ;;
  21. "Iomega Iconnect")
  22. name="iconnect"
  23. ;;
  24. "RaidSonic ICY BOX IB-NAS62x0 (Rev B)")
  25. name="ib62x0"
  26. ;;
  27. "Cloud Engines Pogoplug E02")
  28. name="pogo_e02"
  29. ;;
  30. "Linksys EA3500")
  31. name="ea3500"
  32. ;;
  33. "Linksys EA4500")
  34. name="ea4500"
  35. ;;
  36. "Globalscale Technologies Guruplug Server Plus")
  37. name="guruplug-server-plus"
  38. ;;
  39. "Globalscale Technologies SheevaPlug")
  40. name="sheevaplug"
  41. ;;
  42. "Globalscale Technologies eSATA SheevaPlug")
  43. name="sheevaplug-esata"
  44. ;;
  45. *)
  46. name="generic"
  47. ;;
  48. esac
  49. [ -z "$KIRKWOOD_BOARD_NAME" ] && KIRKWOOD_BOARD_NAME="$name"
  50. [ -z "$KIRKWOOD_MODEL" ] && KIRKWOOD_MODEL="$machine"
  51. [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
  52. echo "$KIRKWOOD_BOARD_NAME" > /tmp/sysinfo/board_name
  53. echo "$KIRKWOOD_MODEL" > /tmp/sysinfo/model
  54. }
  55. kirkwood_board_name() {
  56. local name
  57. [ -f /tmp/sysinfo/board_name ] || kirkwood_board_detect
  58. [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
  59. [ -z "$name" ] && name="unknown"
  60. echo "$name"
  61. }