buildd-prepare-dir 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/bin/bash
  2. # No way I try to deal with a crippled sh just for POSIX foo.
  3. # Copyright (C) 2011 Joerg Jaspert <joerg@debian.org>
  4. #
  5. # This program is free software; you can redistribute it and/or
  6. # modify it under the terms of the GNU General Public License as
  7. # published by the Free Software Foundation; version 2.
  8. #
  9. # This program is distributed in the hope that it will be useful, but
  10. # WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. # General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; if not, write to the Free Software
  16. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. # exit on errors
  18. set -e
  19. # make sure to only use defined variables
  20. set -u
  21. # ERR traps should be inherited from functions too.
  22. set -E
  23. # import the general variable set.
  24. export SCRIPTVARS=/srv/ftp-master.debian.org/dak/config/debian/vars
  25. . $SCRIPTVARS
  26. # And use one locale, no matter what the caller has set
  27. export LANG=C
  28. export LC_ALL=C
  29. PROGRAM="buildd-prepare-dir"
  30. # common functions are "outsourced"
  31. . "${configdir}/common"
  32. # should be relative to the general base dir later
  33. COPYTARGET="${base}/keyrings"
  34. GNUPGHOME="${base}/s3kr1t/dot-gnupg"
  35. buildkeybase="${base}/scripts/builddkeyrings"
  36. TARGET="${buildkeybase}/keyrings"
  37. REMOVED="${buildkeybase}/removed-buildd-keys.gpg"
  38. STAMPFILE="${buildkeybase}/updatedkeyring"
  39. mkdir -p "${TARGET}/buildd-keyrings"
  40. if [ -f "${STAMPFILE}" ]; then
  41. rm -f "${STAMPFILE}"
  42. for arch in $archs; do
  43. if [ -f ${buildkeybase}/${arch}/keyring.gpg ]; then
  44. cp -afl ${buildkeybase}/${arch}/keyring.gpg ${TARGET}/buildd-keyrings/buildd-${arch}-keyring.gpg
  45. chmod 0644 ${TARGET}/buildd-keyrings/buildd-${arch}-keyring.gpg
  46. fi
  47. done
  48. cd ${TARGET}
  49. sha512sum buildd-keyrings/* > sha512sums
  50. rm -f ${TARGET}/sha512sums.txt
  51. SIGNINGKEY=B1326A8D
  52. GNUPGHOME=${GNUPGHOME} gpg --no-options --batch --no-tty --armour --default-key ${SIGNINGKEY} --clearsign -o "${TARGET}/sha512sums.txt" "${TARGET}/sha512sums"
  53. rm -f ${TARGET}/sha512sums
  54. fi