Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.5KB

  1. #!/bin/bash
  2. # from https://github.com/rednoah/notarize-app/blob/master/notarize-app
  3. set -exuo pipefail
  4. DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
  5. ASC_PROVIDER='MischaSpiegelmock10100337'
  6. ASC_USERNAME='thadwooster@gmail.com'
  7. ASC_PASSWORD='@keychain:AC_PASSWORD'
  8. BUNDLE_ID="net.projectm.installer"
  9. BUNDLE_PKG="$DIR/../ProjectM.pkg"
  10. # create temporary files
  11. NOTARIZE_APP_LOG=$(mktemp -t notarize-app)
  12. NOTARIZE_INFO_LOG=$(mktemp -t notarize-info)
  13. # delete temporary files on exit
  14. function finish {
  15. rm "$NOTARIZE_APP_LOG" "$NOTARIZE_INFO_LOG"
  16. }
  17. trap finish EXIT
  18. # submit app for notarization
  19. if xcrun altool --notarize-app --primary-bundle-id "$BUNDLE_ID" --asc-provider "$ASC_PROVIDER" --username "$ASC_USERNAME" --password "$ASC_PASSWORD" -f "$BUNDLE_PKG" > "$NOTARIZE_APP_LOG" 2>&1; then
  20. cat "$NOTARIZE_APP_LOG"
  21. RequestUUID=$(awk -F ' = ' '/RequestUUID/ {print $2}' "$NOTARIZE_APP_LOG")
  22. # check status periodically
  23. while sleep 60 && date; do
  24. # check notarization status
  25. if xcrun altool --notarization-info "$RequestUUID" --asc-provider "$ASC_PROVIDER" --username "$ASC_USERNAME" --password "$ASC_PASSWORD" > "$NOTARIZE_INFO_LOG" 2>&1; then
  26. cat "$NOTARIZE_INFO_LOG"
  27. # once notarization is complete, run stapler and exit
  28. if ! grep -q "Status: in progress" "$NOTARIZE_INFO_LOG"; then
  29. xcrun stapler staple "$BUNDLE_PKG"
  30. exit $?
  31. fi
  32. else
  33. cat "$NOTARIZE_INFO_LOG" 1>&2
  34. exit 1
  35. fi
  36. done
  37. else
  38. cat "$NOTARIZE_APP_LOG" 1>&2
  39. exit 1
  40. fi