release.sh 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #%/bin/bash
  2. #
  3. # Use like: "sh release.sh <versionno>"
  4. #
  5. # Build a "release" .zip file for Optiboot bootloader
  6. # Run from the build directory
  7. # Uncomment if you want a clean builds of specific files
  8. # make clean
  9. # make atmega328
  10. # make atmega168
  11. # make atmega8
  12. rm -Rf /tmp/optiboot-release
  13. #
  14. # Create the 3rd-party hardware extension directory structure
  15. # Note that the structure under "packages" (handed by boards manager)
  16. # is different than the structure under "sketchbook/hardware" would be.
  17. TOP=/tmp/optiboot-release/Optiboot$1/
  18. #
  19. # Bootloaders directory
  20. mkdir -p $TOP/bootloaders/optiboot
  21. # cores, variants, libraries
  22. # mkdir -p $TOP/variants/
  23. mkdir -p $TOP/libraries/
  24. # Less common: firmware, system.
  25. # mkdir -p $TOP/firmwares/
  26. # mkdir -p $TOP/system/
  27. #
  28. # Copy files from whereever into the release directory
  29. cp ../../boards-1.6.txt $TOP/boards.txt
  30. #cp -R ../../examples $TOP/libraries/
  31. #cp -R ../../variants $TOP/
  32. #cp -R ../../system $TOP/
  33. #
  34. # Create platform.txt, because it contains the "group" name for the boards menu
  35. echo name=Optiboot $1 > $TOP/platform.txt
  36. echo version=$1 >> $TOP/platform.txt
  37. #
  38. # Create a README file.
  39. echo This is an Optiboot version $1 \"Binary\" Release. > $TOP/README.TXT
  40. echo >> $TOP/README.TXT
  41. echo For Source code see http://github.com/Optiboot/optiboot>> $TOP/README.TXT
  42. #
  43. # Copy over our "binaries."
  44. cp *.hex $TOP/bootloaders/optiboot
  45. #
  46. # Copy examples ? (examples for a boards.txt don't seem possible?)
  47. # files we'd specifical exclude, if we weren't doing only .hex files.
  48. #rm /tmp/optiboot-release/Optiboot/avr/bootloaders/optiboot/*.lst
  49. #rm /tmp/optiboot-release/Optiboot/avr/bootloaders/optiboot/*~
  50. #rm /tmp/optiboot-release/Optiboot/avr/bootloaders/optiboot/#*
  51. #
  52. # zip everything up.
  53. pushd /tmp/optiboot-release
  54. zip -r Optiboot$1.zip Optiboot$1
  55. HASH=`openssl dgst -sha256 Optiboot$1.zip | sed -e 's/.* //'`
  56. SIZE=`stat -f %z Optiboot$1.zip`
  57. popd
  58. sed -e "s/#.*//" -e "s/%HASH%/$HASH/g" -e "s/%VERSION%/$1/g" -e "s/%SIZE%/$SIZE/g" ../../package_optiboot_optiboot-additional_index.json.TEMPLATE > /tmp/optiboot-release/package_optiboot_optiboot-additional_index.json
  59. #
  60. # This leaves the .zip and the .json file in /tmp/optiboot-release
  61. # where it can be copied to a suitable network location.