roms 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #!/bin/bash
  2. #
  3. # helper script: generate the ROM image release archives
  4. #
  5. # Copyright (C) 2015 Leah Rowe <info@minifree.org>
  6. # Copyright (C) 2015 Patrick "P. J." McDermott <pj@pehjota.net>
  7. #
  8. # This program is free software: you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation, either version 3 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. #
  21. [ "x${DEBUG+set}" = 'xset' ] && set -v
  22. set -u -e
  23. if [ ! -d bin/ ]; then
  24. printf "build/release/roms: no bin/ directory exists. (you haven't built any images)\n"
  25. exit 1
  26. fi
  27. if [ -f "version" ]; then
  28. # _src release archive is being used
  29. version="$(cat version)"
  30. else
  31. # git repo is being used
  32. version="$(git describe --tags HEAD)"
  33. fi
  34. versiondir="release/${version}"
  35. romdir="${versiondir}/rom"
  36. distname="libreboot_${version}"
  37. printf 'Building ROM image release archives for...\n'
  38. cd "bin/"
  39. for payload in *; do
  40. [ ! -d "../${romdir}/${payload}/" ] && mkdir -p "../${romdir}/${payload}/"
  41. cd "${payload}/"
  42. for board in *; do
  43. archivename="${distname}_${payload}_${board}"
  44. printf '...%s' "${payload}/${board}"
  45. # Delete the old archive
  46. rm -f "../../${romdir}/${payload}/${distname}_${board}.tar.xz"
  47. cp -R "${board}/" "${archivename}/"
  48. # Put the version string in the archive.
  49. printf '%s\n' "${version}" >"${archivename}/version"
  50. # Create the compressed archive.
  51. tar -c "${archivename}/" | xz -9e >"../../${romdir}/${payload}/${archivename}.tar.xz"
  52. rm -Rf "${archivename:?}/"
  53. printf ' OK\n'
  54. done
  55. cd "../"
  56. done
  57. cd "../"
  58. printf 'ROM image release archives are stored in %s/\n' "${romdir}"