sha512sums 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/bin/bash
  2. #
  3. # helper script: create sha512sum file for the current snapshot
  4. #
  5. # Copyright (C) 2015 Leah Rowe <info@minifree.org>
  6. #
  7. # This program is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation, either version 3 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. #
  20. [ "x${DEBUG+set}" = 'xset' ] && set -v
  21. set -u -e
  22. if [ -f "version" ]; then
  23. # _src release archive is being used
  24. version="$(cat version)"
  25. versiondate="$(cat versiondate)"
  26. else
  27. # git repo is being used
  28. version="$(git describe --tags HEAD)"
  29. versiondate="$(git show -s --format=%ct)"
  30. fi
  31. versiondir="release/oldbuildsystem/${version}"
  32. sha512filename="SHA512SUMS"
  33. sha512filepath="${versiondir}/${sha512filename}"
  34. if [ ! -d "${versiondir}/" ]; then
  35. printf "build/release/sha512sums: directory %s/ does not exist. You haven't generated any archives yet.\n" "${versiondir}"
  36. exit 1
  37. fi
  38. # delete the old file
  39. rm -f "${sha512filepath}"
  40. # create sha512sum file
  41. printf "Creating list of SHA512 sums in %s...\n" "${sha512filepath}"
  42. (cd "${versiondir}/" && for file in $(find -type f); do sha512sum "${file}" >> "${sha512filename}"; done)
  43. printf "...done.\n"
  44. printf "\n"