Fork of the espurna firmware for `mhsw` switches
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.3 KiB

  1. #!/bin/bash
  2. # Welcome
  3. echo "--------------------------------------------------------------"
  4. echo "ESPURNA FIRMWARE BUILDER"
  5. # Available environments
  6. available=`cat platformio.ini | grep env: | grep -v ota | sed 's/\[env://' | sed 's/\]/ /' | sort`
  7. environments=$@
  8. if [ "$environments" == "list" ]; then
  9. echo "--------------------------------------------------------------"
  10. echo "Available environments:"
  11. for environment in $available; do
  12. echo "* $environment"
  13. done
  14. exit
  15. fi
  16. # Environments to build
  17. if [ $# -eq 0 ]; then
  18. environments=$available
  19. fi
  20. # Get current version
  21. version=`cat espurna/config/version.h | grep APP_VERSION | awk '{print $3}' | sed 's/"//g'`
  22. echo "Building for version $version"
  23. # Create output folder
  24. mkdir -p firmware
  25. # Recreate web interface
  26. echo "--------------------------------------------------------------"
  27. echo "Building web interface..."
  28. node node_modules/gulp/bin/gulp.js || exit
  29. # Build all the required firmwares
  30. echo "--------------------------------------------------------------"
  31. echo "Building firmware images..."
  32. for environment in $environments; do
  33. echo "* espurna-$version-$environment.bin"
  34. platformio run -s -e $environment || exit
  35. mv .pioenvs/$environment/firmware.bin firmware/espurna-$version-$environment.bin
  36. done
  37. echo "--------------------------------------------------------------"