roms 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #!/usr/bin/env 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. versiondate="$(cat versiondate)"
  31. else
  32. # git repo is being used
  33. version="$(git describe --tags HEAD)"
  34. versiondate="$(git show -s --format=%ct)"
  35. fi
  36. versiondir="release/oldbuildsystem/${version}"
  37. romdir="${versiondir}/rom"
  38. distname="libreboot_${version}"
  39. printf 'Building ROM image release archives for...\n'
  40. cd "bin/"
  41. for payload in *; do
  42. [ ! -d "../${romdir}/${payload}/" ] && mkdir -p "../${romdir}/${payload}/"
  43. cd "${payload}/"
  44. for board in *; do
  45. archivename="${distname}_${payload}_${board}"
  46. printf '...%s' "${payload}/${board}"
  47. # Delete the old archive
  48. rm -f "../../${romdir}/${payload}/${distname}_${board}.tar.xz"
  49. cp -R "${board}/" "${archivename}/"
  50. # this has to be done before generating
  51. # the "version" file
  52. if [ ! -f "version" ]; then
  53. # generate ChangeLog and NEWS files
  54. rm -f "ChangeLog" "NEWS"
  55. git log > "${archivename}/ChangeLog"
  56. cp "${archivename}/ChangeLog" "${archivename}/NEWS"
  57. else
  58. # building from release archive
  59. cp "ChangeLog" "${archivename}/"
  60. cp "NEWS" "${archivename}/"
  61. fi
  62. if [ -f "../../RELEASE" ]; then
  63. rm -f "${archivename}/ChangeLog"
  64. rm -f "${archivename}/NEWS"
  65. cp "../../RELEASE" "${archivename}/ChangeLog"
  66. cp "../../RELEASE" "${archivename}/NEWS"
  67. fi
  68. # Put the version string in the archive.
  69. printf '%s\n' "${version}" >"${archivename}/version"
  70. # Put the version date string in the archive
  71. printf '%s\n' "${versiondate}" >"${archivename}/versiondate"
  72. # Create the compressed archive.
  73. tar -c "${archivename}/" | xz -9e >"../../${romdir}/${payload}/${archivename}.tar.xz"
  74. rm -Rf "${archivename:?}/"
  75. printf ' OK\n'
  76. done
  77. cd "../"
  78. done
  79. cd "../"
  80. printf 'ROM image release archives are stored in %s/\n' "${romdir}"