-
-
Save mluton/527de3f78bfa223334e7 to your computer and use it in GitHub Desktop.
Use codesign re-sign swift app
This file contains 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 BUNDLEID | |
# Reading parameters | |
INPUT=$1 | |
OUTPUT=$2.ipa | |
MOBILE_PROVISTION=$3 | |
CER_NAME=$4 | |
ENTITLEMENTS=$5 | |
BUNDLEID=$6 | |
# Cleaning working env | |
rm -r Payload SwiftSupport | |
# Unpackaging app | |
unzip -q $INPUT | |
APP=`ls Payload | tail -1` | |
rm -rf Payload/$APP/_CodeSignature Payload/$APP/CodeResources | |
/usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier $BUNDLEID" ./Payload/$APP/Info.plist | |
# 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" --entitlements $ENTITLEMENTS "Payload/$APP" | |
# Cleaning output env | |
rm -r "$OUTPUT" | |
# Packaging ipa | |
echo "Packaging ipa" | |
zip -qr "$OUTPUT" Payload | |
echo "Re-signed ipa $OUTPUT" |
Hi mluton can you help me? I am not able to use this script.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
--entitlements
option to thecodesign
step._CodeSignature
andCodeResources
.This worked for me to resign an
.ipa
with my own credentials (and bundle ID) including embedded Swift libraries which each need to signed individually.