fresh.sh 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #!/bin/sh
  2. # file: scripts/fresh.sh
  3. # ====================================================================
  4. # symbols;
  5. # --------------------------------------------------------------------
  6. . ${SCRIPTS}/hardware.sh
  7. . ${SCRIPTS}/firmware.sh
  8. # ====================================================================
  9. # confirm connection;
  10. # --------------------------------------------------------------------
  11. echo -n "Interface [${ETH}]: "; read
  12. if [ ! -z ${REPLY} ]; then
  13. ETH=${REPLY}
  14. fi
  15. # ====================================================================
  16. # check connection;
  17. # --------------------------------------------------------------------
  18. int6kwait -xqsi ${ETH}
  19. if [ ${?} != 0 ]; then
  20. echo "Device is not connected"
  21. exit 1
  22. fi
  23. # ====================================================================
  24. # fetch device identity;
  25. # --------------------------------------------------------------------
  26. MAC=$(int6kid -i ${ETH} -A)
  27. DAK=$(int6kid -i ${ETH} -D)
  28. NMK=$(int6kid -i ${ETH} -M)
  29. # ====================================================================
  30. # confirm address;
  31. # --------------------------------------------------------------------
  32. # echo -n "MAC Address [${MAC}]: "; read
  33. # if [ ! -z ${REPLY} ]; then
  34. # MAC="${REPLY}"
  35. # fi
  36. # ====================================================================
  37. # edit PIB;
  38. # --------------------------------------------------------------------
  39. modpib -M ${MAC} -D ${DAK} -N ${NMK} ${PIB}
  40. if [ ${?} != 0 ]; then
  41. exit 1
  42. fi
  43. # ====================================================================
  44. # erase NVRAM;
  45. # --------------------------------------------------------------------
  46. int6kp -xi ${ETH} -D ${DAK} -X
  47. if [ ${?} != 0 ]; then
  48. exit 1
  49. fi
  50. # ====================================================================
  51. # start firmware;
  52. # --------------------------------------------------------------------
  53. int6kf -xi ${ETH} -C ${CFG} -P ${PIB} -N ${NVM}
  54. if [ ${?} != 0 ]; then
  55. exit 1
  56. fi
  57. # ====================================================================
  58. # define final firmware;
  59. # --------------------------------------------------------------------
  60. PIB=${FIRMWARE}/v3.3.0.pib
  61. NVM=${FIRMWARE}/v3.3.0-0-5-B-FINAL.nvm
  62. # ====================================================================
  63. # download firmware then force flash device;
  64. # --------------------------------------------------------------------
  65. int6k -xi ${ETH} -P ${PIB} -N ${NVM} -FF
  66. if [ ${?} != 0 ]; then
  67. exit 1
  68. fi
  69. # ====================================================================
  70. # return success;
  71. # --------------------------------------------------------------------
  72. exit 0