kirkwood.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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="linksys-audi"
  32. ;;
  33. "Linksys E4200v2 / EA4500")
  34. name="linksys-viper"
  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. "ZyXEL NSA310S")
  46. name="nsa310s"
  47. ;;
  48. *)
  49. name="generic"
  50. ;;
  51. esac
  52. [ -z "$KIRKWOOD_BOARD_NAME" ] && KIRKWOOD_BOARD_NAME="$name"
  53. [ -z "$KIRKWOOD_MODEL" ] && KIRKWOOD_MODEL="$machine"
  54. [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
  55. echo "$KIRKWOOD_BOARD_NAME" > /tmp/sysinfo/board_name
  56. echo "$KIRKWOOD_MODEL" > /tmp/sysinfo/model
  57. }
  58. kirkwood_board_name() {
  59. local name
  60. [ -f /tmp/sysinfo/board_name ] || kirkwood_board_detect
  61. [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
  62. [ -z "$name" ] && name="unknown"
  63. echo "$name"
  64. }