erase.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/sh
  2. # file: scripts/erase.sh
  3. # this script erases flash memory only on selected firmware versions;
  4. # ====================================================================
  5. # symbols;
  6. # --------------------------------------------------------------------
  7. . /etc/environment
  8. . ${SCRIPTS}/hardware.sh
  9. . ${SCRIPTS}/firmware.sh
  10. # ====================================================================
  11. # query connection;
  12. # --------------------------------------------------------------------
  13. echo -n "Interface [${ETH}]: "; read
  14. if [ ! -z ${REPLY} ]; then
  15. ETH=${REPLY}
  16. fi
  17. # ====================================================================
  18. # check connection;
  19. # --------------------------------------------------------------------
  20. int6kwait -xqsi ${ETH}
  21. if [ ${?} != 0 ]; then
  22. echo "Device is not connected"
  23. exit 1
  24. fi
  25. # ====================================================================
  26. # read device DAK;
  27. # --------------------------------------------------------------------
  28. DAK=$(int6kid -i ${ETH} -D)
  29. # ====================================================================
  30. # erase NVRAM on local device; only works on some firmware versions;
  31. # --------------------------------------------------------------------
  32. int6kp -i ${ETH} -D ${DAK} -E
  33. if [ ${?} != 0 ]; then
  34. exit 1
  35. fi
  36. # ====================================================================
  37. # return success;
  38. # --------------------------------------------------------------------
  39. exit 0