[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sigh][resign] Fixing replacement of bundle IDs in Patched Entitlements when doing sigh resign with similar old and new bundle ids #22058

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions sigh/lib/assets/resign.sh
Original file line number Diff line number Diff line change
Expand Up @@ -854,14 +854,11 @@ function resign {
# Read old bundle ID from the old Info.plist which was saved for this purpose
OLD_BUNDLE_ID="$(PlistBuddy -c "Print :CFBundleIdentifier" "$TEMP_DIR/oldInfo.plist")"
NEW_BUNDLE_ID="$(bundle_id_for_provision "$NEW_PROVISION")"
# replacing . as \. because sed uses . as any character
OLD_BUNDLE_ID=$(echo ${OLD_BUNDLE_ID} | sed "s!\\.!\\\\.!g")
NEW_BUNDLE_ID=$(echo ${NEW_BUNDLE_ID} | sed "s!\\.!\\\\.!g")
log "Replacing old bundle ID '$OLD_BUNDLE_ID' with new bundle ID '$NEW_BUNDLE_ID' in patched entitlements"
# Note: ideally we'd match against the opening <string> tag too, but this isn't possible
# because $OLD_BUNDLE_ID and $NEW_BUNDLE_ID do not include the team ID prefix which is
# present in the entitlements file.
# e.g. <string>AB1GP98Q19.com.example.foo</string>
# vs
# com.example.foo
/usr/bin/sed -i .bak "s!${OLD_BUNDLE_ID}</string>!${NEW_BUNDLE_ID}</string>!g" "$PATCHED_ENTITLEMENTS"
/usr/bin/sed -i .bak "s!\(<string>[A-Z0-9]\{10\}\)\.${OLD_BUNDLE_ID}</string>!\1.${NEW_BUNDLE_ID}</string>!g" "$PATCHED_ENTITLEMENTS"

log "Resigning application using certificate: '$CERTIFICATE'"
log "and patched entitlements:"
Expand Down