Fixed Custom BundleID modification. Replacing the bundleid also of internal apps when using a custom bundle id

This commit is contained in:
2016-12-18 23:59:53 +00:00
parent 6b9541e506
commit 0dbc2cf22d
2 changed files with 16 additions and 3 deletions

View File

@@ -35,4 +35,11 @@ make sure that ipasourcefolder and ipadestfolder are writable.
run signall.sh via terminal. run signall.sh via terminal.
done. done.
In your destination folder you will have all your ipas signed. In your destination folder you will have all your ipas signed.
Additional notes
To change bundleid replace null.null inside the signall.sh script with your custom bundleid.
Restore to null.null to use bundleid included in the ipa.
Using a custom bundleid, if the ipa includes additional apps (for example widget and apple watch), the script will automatically change these bundleids using the following convention : custombundleid.extra1, custombundleid.extra2 and so on.
If you want to change a bundleid for a particular ipa, use only that ipa in the source folder otherwise all ipas present in the source folder will be signed using the same bundleid.

10
sign.sh
View File

@@ -13,7 +13,7 @@ cp "$MOBILEPROV" "extracted/Payload/$APPLICATION/embedded.mobileprovision"
echo "Resigning with certificate: $DEVELOPER" echo "Resigning with certificate: $DEVELOPER"
find -d extracted \( -name "*.app" -o -name "*.appex" -o -name "*.framework" -o -name "*.dylib" \) > directories.txt find -d extracted \( -name "*.app" -o -name "*.appex" -o -name "*.framework" -o -name "*.dylib" \) > directories.txt
if [ "$BUNDLE" != 'null.null' ]; then if [[ "$BUNDLE" != 'null.null' ]]; then
echo "Changing BundleID with : $BUNDLE" echo "Changing BundleID with : $BUNDLE"
/usr/libexec/PlistBuddy -c "Set:CFBundleIdentifier $BUNDLE" "extracted/Payload/$APPLICATION/Info.plist" /usr/libexec/PlistBuddy -c "Set:CFBundleIdentifier $BUNDLE" "extracted/Payload/$APPLICATION/Info.plist"
fi fi
@@ -21,10 +21,16 @@ security cms -D -i "extracted/Payload/$APPLICATION/embedded.mobileprovision" > t
/usr/libexec/PlistBuddy -x -c 'Print:Entitlements' t_entitlements_full.plist > t_entitlements.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: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 #/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
var=$((0))
while IFS='' read -r line || [[ -n "$line" ]]; do 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/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 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/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
if [[ "$BUNDLE" != 'null.null' ]] && [[ "$line" == *".appex"* ]]; then
echo "Changing .appex BundleID with : $BUNDLE.extra$var"
/usr/libexec/PlistBuddy -c "Set:CFBundleIdentifier $BUNDLE.extra$var" "$line/Info.plist"
var=$((var+1))
fi
/usr/bin/codesign --continue -f -s "$DEVELOPER" --entitlements "t_entitlements.plist" "$line" /usr/bin/codesign --continue -f -s "$DEVELOPER" --entitlements "t_entitlements.plist" "$line"
done < directories.txt done < directories.txt
@@ -40,4 +46,4 @@ rm t_entitlements.plist
rm t_entitlements_full.plist rm t_entitlements_full.plist
#rm t_entitlements_original.plist #rm t_entitlements_original.plist
#rm t_entitlements_application-identifier #rm t_entitlements_application-identifier
#rm t_entitlements_com.apple.developer.team-identifier #rm t_entitlements_com.apple.developer.team-identifier