2015-02-06 09:35:48 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-10-28 06:09:45 -04:00
|
|
|
if [ "$#" -ne 1 ]; then
|
|
|
|
echo "Usage: appsign.sh *build dir*"
|
2015-02-28 06:20:04 -05:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2015-02-06 09:35:48 -05:00
|
|
|
# Build location
|
2015-10-28 06:09:45 -04:00
|
|
|
BUILD=$1
|
2015-02-06 09:35:48 -05:00
|
|
|
|
|
|
|
# Generate the MD5 hash
|
2015-08-23 21:28:10 -04:00
|
|
|
# md5 on Darwin, md5sum on Unix
|
|
|
|
if [ `uname -s` = "Darwin" ]; then
|
|
|
|
echo -n `md5 -q $BUILD/application.bin` > __md5hash.bin
|
|
|
|
else
|
2015-02-25 16:26:16 -05:00
|
|
|
echo -n `md5sum --binary $BUILD/application.bin | awk '{ print $1 }'` > __md5hash.bin
|
2015-08-23 21:28:10 -04:00
|
|
|
fi
|
2015-02-06 09:35:48 -05:00
|
|
|
|
|
|
|
# Concatenate it with the application binary
|
2015-04-10 15:02:07 -04:00
|
|
|
cat $BUILD/application.bin __md5hash.bin > $BUILD/mcuimg.bin
|
2015-02-21 04:52:19 -05:00
|
|
|
RET=$?
|
2015-02-06 09:35:48 -05:00
|
|
|
|
|
|
|
# Remove the tmp files
|
|
|
|
rm -f __md5hash.bin
|
|
|
|
|
2015-04-10 15:02:07 -04:00
|
|
|
# Remove the unsigned binary
|
2015-02-06 09:35:48 -05:00
|
|
|
rm -f $BUILD/application.bin
|
2015-02-21 04:52:19 -05:00
|
|
|
|
2015-02-28 06:20:04 -05:00
|
|
|
exit $RET
|