Skip to content

Instantly share code, notes, and snippets.

@shannah
Created November 10, 2014 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shannah/fb2d89592f627d67d162 to your computer and use it in GitHub Desktop.
Save shannah/fb2d89592f627d67d162 to your computer and use it in GitHub Desktop.
Script I used for codesigning
<!-- Example usage from build.xml file --->
<exec executable="./codesign.sh">
<!-- Path to the App -->
<arg value="path/to/MyApp.app"/>
<!-- Name of certificate to use to sign app -->
<arg value="3rd Party Mac Developer Application: XXX"/>
<!-- Path to entitlements file. Optional -->
<arg value="path/to/myapp.entitlements"/>
<!-- Path to jdk directory inside MyApp -->
<arg value="path/to/MyApp.app/Contents/PlugIns/jdk1.7.0_25.jdk"/>
</exec>
#!/bin/sh
export APP_PATH="$1/Contents"
export CERT="$2"
export ENTITLEMENTS_PATH="$3"
export JDK_PATH="$4"
if [ -z $ENTITLEMENTS_PATH ]; then
find "$APP_PATH" -type f \( -name "*.jar" -or -name "*.dylib" -or -name "*.jnilib" \) -exec codesign --verbose=4 -f -s "$CERT" {} \;
find "$APP_PATH" -type f \( -name "*.jar" -or -name "*.dylib" -or -name "*.jnilib" \) -exec codesign --verbose=4 --verify {} \;
find "$JDK_PATH/Contents" -type f \( -name "*.jar" -or -name "*.dylib" \) -exec codesign --verbose=4 -f -s "$CERT" {} \;
find "$JDK_PATH/Contents" -type f \( -name "*.jar" -or -name "*.dylib" \) -exec codesign --verbose=4 --verify {} \;
codesign --deep --verbose=4 -f -s "$CERT" "$JDK_PATH"
codesign --deep --verbose=4 -f -s "$CERT" "$1"
else
find "$APP_PATH" -type f \( -name "*.jar" -or -name "*.dylib" -or -name "*.jnilib" \) -exec codesign --verbose=4 -f -s "$CERT" --entitlements "$ENTITLEMENTS_PATH" {} \;
find "$APP_PATH" -type f \( -name "*.jar" -or -name "*.dylib" -or -name "*.jnilib" \) -exec codesign --verbose=4 --verify {} \;
find "$JDK_PATH/Contents" -type f \( -name "*.jar" -or -name "*.dylib" \) -exec codesign --verbose=4 -f -s "$CERT" --entitlements "$ENTITLEMENTS_PATH" {} \;
find "$JDK_PATH/Contents" -type f \( -name "*.jar" -or -name "*.dylib" \) -exec codesign --verbose=4 --verify {} \;
codesign --deep --verbose=4 -f -s "$CERT" --entitlements "$ENTITLEMENTS_PATH" "$JDK_PATH"
codesign --deep --verbose=4 -f -s "$CERT" --entitlements "$ENTITLEMENTS_PATH" "$1"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment