1
0
Fork 0
jai-resources/macos_development/codesign_macos.sh

36 lines
852 B
Bash
Raw Permalink Normal View History

2024-04-22 22:16:37 +00:00
#!/bin/bash
#
# Example Usage:
#
# ./codesign_macos.sh test.app/Contents/MacOs/test ./
#
# To use this file properly, you need to create a signing identity, and
# replace the string <replace_this> with the code Apple provides.
# See ./how_to_setup_for_macos_and_ios_development.md for instructions
CODE_SIGN_IDENTITY="<replace_this>"
PATH_TO_EXECUTABLE=$1
PATH_TO_ENTITLEMENTS_FILE=$2
app_entitlements_file="$PATH_TO_ENTITLEMENTS_FILE/Entitlements.xcent"
echo "Codesigning..."
echo " Executable: ${PATH_TO_EXECUTABLE}"
echo " Entitlements {app_entitlements_file}"
echo
# Do the actual codesigning
codesign \
--generate-entitlement-der \
--force \
--timestamp\=none \
--entitlements ${app_entitlements_file} \
--sign $CODE_SIGN_IDENTITY \
${PATH_TO_EXECUTABLE}
if [ $? -ne 0 ]; then
echo
echo " Code signing Failed"
exit 1
fi