Created
October 21, 2015 20:02
-
-
Save 4c00h/3ca107f6653ec2191a07 to your computer and use it in GitHub Desktop.
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/bash | |
#name of ipa file | |
IPA="" | |
#path to .mobileprovision | |
PROVISION="" | |
#certificate name as appears in the keychain e.g. "iPhone Distribution: Example " | |
CERTIFICATE="" | |
#bundle identifier e.g. com.yourcompany.app | |
BUNDLE_ID="" | |
########### | |
unzip -q "$IPA" | |
# remove the signature | |
rm -rf Payload/*.app/_CodeSignature Payload/*.app/CodeResources | |
# extract plist from .mobileprovision file | |
security cms -D -i "$PROVISION" > ProvisionProfile.plist 2>&1 | |
# extract entitilements.plist from plist | |
/usr/libexec/PlistBuddy -x -c "Print Entitlements" ProvisionProfile.plist > Entitlements.plist 2>&1 | |
# replace the provision | |
cp "$PROVISION" Payload/*.app/embedded.mobileprovision | |
#Modify bundle identifier in Info.plist as shown in apple developer center (e.g. com.yourcompany.app). | |
$(/usr/libexec/PlistBuddy -x -c 'Set :CFBundleIdentifier '$BUNDLE_ID'' Payload/advomobo.app/Info.plist) | |
# Verify bundle_id changed correctly | |
/usr/libexec/PlistBuddy -c 'Print :CFBundleIdentifier' ~/Downloads/Payload/advomobo.app/Info.plist | |
# sign with the new certificate | |
codesign -f -s "$CERTIFICATE" --entitlements Entitlements.plist Payload/advomobo.app | |
zip -qr resigned.ipa Payload |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment