-
-
Save doubov/a90868ad0e9a40461954038560dda75a to your computer and use it in GitHub Desktop.
Use codesign re-sign swift app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Usage: ./sign.sh INPUT.ipa OUTPUT PROVISION.mobileprovision IDENTITY_NAME ENTITLEMENTS | |
| # Reading parameters | |
| INPUT=$1 | |
| OUTPUT=$2.ipa | |
| MOBILE_PROVISTION=$3 | |
| CER_NAME=$4 | |
| # ENTITLEMENTS=$5 | |
| # Cleaning working env | |
| rm -r Payload SwiftSupport | |
| # Unpackaging app | |
| unzip -q $INPUT | |
| APP=`ls Payload | tail -1` | |
| # Replacing mobile provision | |
| echo "Deleting original embedded.mobileprovision" | |
| rm "Payload/$APP/embedded.mobileprovision" | |
| echo "Copying embedded.mobileprovision" | |
| cp "$MOBILE_PROVISTION" "Payload/$APP/embedded.mobileprovision" | |
| # Resigning ipa | |
| echo "Re-sign by $CER_NAME" | |
| # Resigning dylibs | |
| if [ -e Payload/$APP/Frameworks ] | |
| then | |
| for dylib in "Payload/$APP/Frameworks/*" | |
| do | |
| codesign -f -s "$CER_NAME" $dylib | |
| done | |
| fi | |
| # Resigning app | |
| codesign -f -s "$CER_NAME" "Payload/$APP" | |
| # Cleaning output env | |
| rm -r "$OUTPUT" | |
| # Packaging ipa | |
| echo "Packaging ipa" | |
| zip -qr "$OUTPUT" Payload | |
| echo "Re-signed ipa $OUTPUT" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment