appsign.sh 589 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/bash
  2. if [ "$#" -ne 1 ]; then
  3. echo "Usage: appsign.sh *build dir*"
  4. exit 1
  5. fi
  6. # Build location
  7. BUILD=$1
  8. # Generate the MD5 hash
  9. # md5 on Darwin, md5sum on Unix
  10. if [ `uname -s` = "Darwin" ]; then
  11. echo -n `md5 -q $BUILD/application.bin` > __md5hash.bin
  12. else
  13. echo -n `md5sum --binary $BUILD/application.bin | awk '{ print $1 }'` > __md5hash.bin
  14. fi
  15. # Concatenate it with the application binary
  16. cat $BUILD/application.bin __md5hash.bin > $BUILD/mcuimg.bin
  17. RET=$?
  18. # Remove the tmp files
  19. rm -f __md5hash.bin
  20. # Remove the unsigned binary
  21. rm -f $BUILD/application.bin
  22. exit $RET