Repository: chenhengjie123/iOS_resign_scripts Branch: master Commit: 90123d1f457f Files: 4 Total size: 7.8 KB Directory structure: gitextract_o5zst6cb/ ├── README.md ├── ios_resign_from_app_to_ipa ├── ios_resign_with_app └── ios_resign_with_ipa ================================================ FILE CONTENTS ================================================ ================================================ FILE: README.md ================================================ # iOS_resign_scripts Scripts for resign iOS App (With Framework and dylib included). Only works on Mac OS X ## Requirement Xcode command line tool ## Usage * ios_resign_from_app_to_ipa Assume folder app-extracted is the folder that created by running `unzip app.ipa -d app-extracted` ``` $ ls app-extracted META-INF Payload iTunesArtwork iTunesMetadata.plist ``` Then it should be use like below: ``` $ ios_resign_from_app_to_ipa app-extracted $Developer_code_sign $mobileprovision $target_ipa_related_path ``` example: ``` $ ios_resign_from_app_to_ipa app-extracted "iPhone Developer: hengjie chen (XXXXXXXX)" embedded.mobileprovision Testerhome-resigned.ipa ``` * ios_resign_with_app Usage: ``` $ ios_resign_with_app $source_app_file $Developer_code_sign $mobileprovision $target_app_related_path ``` Example: ``` $ ios_resign_with_app Testerhome.app "iPhone Developer: hengjie chen (XXXXXXXX)" embedded.mobileprovision Testerhome-resigned.app ``` * ios_resign_with_ipa Usage: ``` $ ios_resign_with_ipa $source_ipa_file $Developer_code_sign $mobileprovision $target_app_related_path ``` Example: ``` $ ios_resign_with_ipa Testerhome.ipa "iPhone Developer: hengjie chen (XXXXXXXX)" embedded.mobileprovision Testerhome-resigned.ipa ``` # Thanks Thanks http://www.xgiovio.com/blog-photos-videos-other/blog/resign-your-ios-ipa-frameworks-and-plugins-included/ . I created these scripts beyond it. ================================================ FILE: ios_resign_from_app_to_ipa ================================================ # !/bin/bash # from http://www.xgiovio.com/blog-photos-videos-other/blog/resign-your-ios-ipa-frameworks-and-plugins-included/ SOURCEAPPFOLDER="$1" DEVELOPER="$2" MOBILEPROV="$3" TARGET="$4" # target ipa name(relative path) # ENTITLEMENTS="$5" # unzip -qo "$SOURCEAPPFOLDER" -d extracted # APPLICATION=$(ls extracted/Payload/) cp -r "$SOURCEAPPFOLDER" extracted APPLICATION=$(ls extracted/Payload/) cp "$MOBILEPROV" "extracted/Payload/$APPLICATION/embedded.mobileprovision" echo "Resigning with certificate: $DEVELOPER" >&2 find -d extracted \( -name "*.app" -o -name "*.appex" -o -name "*.framework" -o -name "*.dylib" \) > directories.txt security cms -D -i "extracted/Payload/$APPLICATION/embedded.mobileprovision" > t_entitlements_full.plist /usr/libexec/PlistBuddy -x -c 'Print:Entitlements' t_entitlements_full.plist > t_entitlements.plist #/usr/libexec/PlistBuddy -c 'Print:application-identifier' t_entitlements.plist > t_entitlements_application-identifier #save developer application-identifier to file #/usr/libexec/PlistBuddy -c 'Print:com.apple.developer.team-identifier' t_entitlements.plist > t_entitlements_com.apple.developer.team-identifier #save com.apple.developer.team-identifier application-identifier to file while IFS='' read -r line || [[ -n "$line" ]]; do #/usr/bin/codesign -d --entitlements :- "$line" > t_entitlements_original.plist #save original entitlements from the app #/usr/libexec/PlistBuddy -x -c 'Import application-identifier t_entitlements_application-identifier' t_entitlements_original.plist #overwrite application-identifier #/usr/libexec/PlistBuddy -x -c 'Import com.apple.developer.team-identifier t_entitlements_com.apple.developer.team-identifier' t_entitlements_original.plist #overwrite com.apple.developer.team-identifier /usr/bin/codesign --continue -f -s "$DEVELOPER" --entitlements "t_entitlements.plist" "$line" done < directories.txt echo "Creating the Signed IPA" xcrun -sdk iphoneos PackageApplication -v extracted/Payload/$APPLICATION -o `pwd`/"$TARGET" echo "Created ipa $TARGET" rm -rf "extracted" rm directories.txt rm t_entitlements.plist rm t_entitlements_full.plist #rm t_entitlements_original.plist #rm t_entitlements_application-identifier #rm t_entitlements_com.apple.developer.team-identifier ================================================ FILE: ios_resign_with_app ================================================ # !/bin/bash # from http://www.xgiovio.com/blog-photos-videos-other/blog/resign-your-ios-ipa-frameworks-and-plugins-included/ SOURCEAPP="$1" DEVELOPER="$2" MOBILEPROV="$3" TARGET="$4" # target app name # ENTITLEMENTS="$5" # unzip -qo "$SOURCEAPP" -d extracted # APPLICATION=$(ls extracted/Payload/) cp -r "$SOURCEAPP" "tmp.app" APPLICATION="tmp.app" cp "$MOBILEPROV" "$APPLICATION/embedded.mobileprovision" echo "Resigning with certificate: $DEVELOPER" >&2 find -d $APPLICATION \( -name "*.app" -o -name "*.appex" -o -name "*.framework" -o -name "*.dylib" \) > directories.txt security cms -D -i "$APPLICATION/embedded.mobileprovision" > t_entitlements_full.plist /usr/libexec/PlistBuddy -x -c 'Print:Entitlements' t_entitlements_full.plist > t_entitlements.plist #/usr/libexec/PlistBuddy -c 'Print:application-identifier' t_entitlements.plist > t_entitlements_application-identifier #save developer application-identifier to file #/usr/libexec/PlistBuddy -c 'Print:com.apple.developer.team-identifier' t_entitlements.plist > t_entitlements_com.apple.developer.team-identifier #save com.apple.developer.team-identifier application-identifier to file while IFS='' read -r line || [[ -n "$line" ]]; do #/usr/bin/codesign -d --entitlements :- "$line" > t_entitlements_original.plist #save original entitlements from the app #/usr/libexec/PlistBuddy -x -c 'Import application-identifier t_entitlements_application-identifier' t_entitlements_original.plist #overwrite application-identifier #/usr/libexec/PlistBuddy -x -c 'Import com.apple.developer.team-identifier t_entitlements_com.apple.developer.team-identifier' t_entitlements_original.plist #overwrite com.apple.developer.team-identifier /usr/bin/codesign --continue -f -s "$DEVELOPER" --entitlements "t_entitlements.plist" "$line" done < directories.txt echo "Creating the Signed APP" mv tmp.app "$TARGET" echo "Created app: $TARGET" # rm -rf "extracted" rm directories.txt rm t_entitlements.plist rm t_entitlements_full.plist #rm t_entitlements_original.plist #rm t_entitlements_application-identifier #rm t_entitlements_com.apple.developer.team-identifier ================================================ FILE: ios_resign_with_ipa ================================================ # !/bin/bash # from http://www.xgiovio.com/blog-photos-videos-other/blog/resign-your-ios-ipa-frameworks-and-plugins-included/ SOURCEIPA="$1" DEVELOPER="$2" MOBILEPROV="$3" TARGET="$4" unzip -qo "$SOURCEIPA" -d extracted APPLICATION=$(ls extracted/Payload/) cp "$MOBILEPROV" "extracted/Payload/$APPLICATION/embedded.mobileprovision" echo "Resigning with certificate: $DEVELOPER" >&2 find -d extracted \( -name "*.app" -o -name "*.appex" -o -name "*.framework" -o -name "*.dylib" \) > directories.txt security cms -D -i "extracted/Payload/$APPLICATION/embedded.mobileprovision" > t_entitlements_full.plist /usr/libexec/PlistBuddy -x -c 'Print:Entitlements' t_entitlements_full.plist > t_entitlements.plist #/usr/libexec/PlistBuddy -c 'Print:application-identifier' t_entitlements.plist > t_entitlements_application-identifier #save developer application-identifier to file #/usr/libexec/PlistBuddy -c 'Print:com.apple.developer.team-identifier' t_entitlements.plist > t_entitlements_com.apple.developer.team-identifier #save com.apple.developer.team-identifier application-identifier to file while IFS='' read -r line || [[ -n "$line" ]]; do #/usr/bin/codesign -d --entitlements :- "$line" > t_entitlements_original.plist #save original entitlements from the app #/usr/libexec/PlistBuddy -x -c 'Import application-identifier t_entitlements_application-identifier' t_entitlements_original.plist #overwrite application-identifier #/usr/libexec/PlistBuddy -x -c 'Import com.apple.developer.team-identifier t_entitlements_com.apple.developer.team-identifier' t_entitlements_original.plist #overwrite com.apple.developer.team-identifier /usr/bin/codesign --continue -f -s "$DEVELOPER" --entitlements "t_entitlements.plist" "$line" done < directories.txt echo "Creating the Signed IPA" cd extracted zip -qry ../extracted.ipa * cd .. mv extracted.ipa "$TARGET" rm -rf "extracted" rm directories.txt rm t_entitlements.plist rm t_entitlements_full.plist #rm t_entitlements_original.plist #rm t_entitlements_application-identifier #rm t_entitlements_com.apple.developer.team-identifier