sign_app.sh 568 B

12345678910111213141516171819
  1. #!/bin/sh -xe
  2. [ "$#" -lt 2 ] && echo "Usage: sign_app.sh <app> <identity> <team_identifier>" && exit
  3. src_app="$1"
  4. identity="$2"
  5. team_identifier="$3"
  6. codesign -s "$identity" --force --preserve-metadata=entitlements --verbose=4 --deep "$src_app"
  7. # Verify the signature
  8. codesign -dv $src_app
  9. codesign --verify -v $src_app
  10. spctl -a -t exec -vv $src_app
  11. # Validate that the key used for signing the binary matches the expected TeamIdentifier
  12. # needed to pass the SocketApi through the sandbox
  13. codesign -dv $src_app 2>&1 | grep "TeamIdentifier=$team_identifier"
  14. exit $?