start.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/bin/sh
  2. # file: scripts/start.sh
  3. # use int6kf to start firmware on a device having a blank or corrupted
  4. # NVRAM; this is a standard Intellon script that has proven useful but
  5. # feel free to make changes;
  6. # ====================================================================
  7. # host symbols;
  8. # --------------------------------------------------------------------
  9. . /etc/environment
  10. . ${SCRIPTS}/hardware.sh
  11. . ${SCRIPTS}/firmware.sh
  12. # ====================================================================
  13. # query connection;
  14. # --------------------------------------------------------------------
  15. echo -n "Interface [${ETH}]: "; read
  16. if [ ! -z ${REPLY} ]; then
  17. ETH=${REPLY}
  18. fi
  19. # ====================================================================
  20. # define random DAK and NMK;
  21. # --------------------------------------------------------------------
  22. MAC=auto
  23. DAK=$(rkey secret.key -D)
  24. NMK=$(rkey secret.key -M)
  25. # ====================================================================
  26. # update PIB file with MAC, DAK and NMK;
  27. # --------------------------------------------------------------------
  28. modpib -M ${MAC} -D ${DAK} -N ${NMK} ${PIB} -v
  29. if [ ${?} != 0 ]; then
  30. exit 1
  31. fi
  32. # ====================================================================
  33. # write CFG, FW and PIB to device and start FW execution;
  34. # --------------------------------------------------------------------
  35. int6kf -i ${ETH} -C ${CFG} -P ${PIB} -N ${NVM}
  36. if [ ${?} != 0 ]; then
  37. exit 1
  38. fi
  39. # ====================================================================
  40. # confirm device identity;
  41. # --------------------------------------------------------------------
  42. int6k -i ${ETH} -I
  43. # ====================================================================
  44. #
  45. # --------------------------------------------------------------------
  46. exit 0