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.

51 lines
1.6 KiB

6 years ago
6 years ago
6 years ago
  1. #!/bin/bash
  2. # Welcome
  3. echo "--------------------------------------------------------------"
  4. echo "ESPURNA FIRMWARE BUILDER"
  5. # Available environments
  6. available=$(grep env: platformio.ini | grep -v ota | grep -v ssl | 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=$(grep APP_VERSION espurna/config/version.h | awk '{print $3}' | sed 's/"//g')
  22. echo "Building for version $version"
  23. # Create output folder
  24. mkdir -p firmware
  25. if [ ! -e node_modules/gulp/bin/gulp.js ]; then
  26. echo "--------------------------------------------------------------"
  27. echo "Installing dependencies..."
  28. npm install --only=dev
  29. fi
  30. # Recreate web interface
  31. echo "--------------------------------------------------------------"
  32. echo "Building web interface..."
  33. node node_modules/gulp/bin/gulp.js || exit
  34. # Build all the required firmware images
  35. echo "--------------------------------------------------------------"
  36. echo "Building firmware images..."
  37. mkdir -p ../firmware/espurna-$version
  38. for environment in $environments; do
  39. echo "* espurna-$version-$environment.bin"
  40. platformio run --silent --environment $environment || exit
  41. mv .pioenvs/$environment/firmware.bin ../firmware/espurna-$version/espurna-$version-$environment.bin
  42. done
  43. echo "--------------------------------------------------------------"