octeon.sh 856 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/sh
  2. #
  3. # Copyright (C) 2010-2013 OpenWrt.org
  4. #
  5. OCTEON_BOARD_NAME=
  6. OCTEON_MODEL=
  7. octeon_board_detect() {
  8. local machine
  9. local name
  10. machine=$(grep "^system type" /proc/cpuinfo | sed "s/system type.*: \(.*\)/\1/g")
  11. case "$machine" in
  12. "UBNT_E100"*)
  13. name="erlite"
  14. ;;
  15. "UBNT_E200"*)
  16. name="er"
  17. ;;
  18. "UBNT_E220"*)
  19. name="erpro"
  20. ;;
  21. *)
  22. name="generic"
  23. ;;
  24. esac
  25. [ -z "$OCTEON_BOARD_NAME" ] && OCTEON_BOARD_NAME="$name"
  26. [ -z "$OCTEON_MODEL" ] && OCTEON_MODEL="$machine"
  27. [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
  28. echo "$OCTEON_BOARD_NAME" > /tmp/sysinfo/board_name
  29. echo "$OCTEON_MODEL" > /tmp/sysinfo/model
  30. }
  31. octeon_board_name() {
  32. local name
  33. [ -f /tmp/sysinfo/board_name ] || octeon_board_detect
  34. [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
  35. [ -z "$name" ] && name="unknown"
  36. echo "$name"
  37. }