create-sign-tarball.sh 823 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/sh
  2. # Process command-line arguments
  3. SCRYPTVERSION=$1
  4. GNUPG_SIGNING_HOME=$2
  5. # Check for required arguments
  6. if [ -z "${SCRYPTVERSION}" ] || [ -z "${GNUPG_SIGNING_HOME}" ]; then
  7. echo "Usage: $0 SCRYPTVERSION GNUPG_SIGNING_HOME"
  8. exit 1
  9. fi
  10. # Check for correct OS
  11. if [ "$(uname)" != "FreeBSD" ]; then
  12. echo "Error: This script only works on FreeBSD due to the"
  13. echo " sha256 \${PKGNAME}.tgz"
  14. echo "command, which has a different meaning on other OSes."
  15. exit 1
  16. fi
  17. # Constants
  18. PKGNAME=scrypt-${SCRYPTVERSION}
  19. PKGSIGS=scrypt-sigs-${SCRYPTVERSION}
  20. # Get directory of script
  21. dir=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)
  22. # Create tarball
  23. sh "${dir}/mktarball.sh" "${SCRYPTVERSION}"
  24. # Sign tarball
  25. sha256 "${PKGNAME}.tgz" | \
  26. GNUPGHOME=${GNUPG_SIGNING_HOME} gpg --clearsign \
  27. > "${PKGSIGS}.asc"