IPA 재서명 스크립트는 이걸로 종결
#!/bin/sh
## check your certification name
# security find-identity -v -p codesigning
certification_name="iPhone ???: ???"
## your profile path
profile="/Users/~~~/???.mobileprovision"
ipa=$1
## set entitlements
security cms -D -i "$profile" > ProvisionProfile.plist
/usr/libexec/PlistBuddy -x -c "Print Entitlements" ProvisionProfile.plist > Entitlements.plist
## unzip IPA
echo "[START] unzip IPA"
unzip -qq "$ipa"
echo "[END] unzip IPA"
filename=`basename $ipa ".ipa"`
bundlename=`basename Payload/*.app ".app"`
## remove CodeSignature
rm -rf "Payload/$bundlename.app/_CodeSignature/"
echo "[SUCCESS] remove CodeSignature"
## copy profile
cp "$profile" "Payload/$bundlename.app/embedded.mobileprovision"
echo "[SUCCESS] copy embedded.mobileprovision"
## codesign
codesign -f -s "$certification_name" --entitlements Entitlements.plist Payload/$bundlename.app
echo "[SUCCESS] codesign"
echo "[START] zip IPA"
outputsub="_resigned.ipa"
output=$filename$outputsub
zip -qr "$output" Payload
echo "[END] zip IPA"
## remove files
rm -rf ProvisionProfile.plist
rm -rf Entitlements.plist
rm -rf Payload
echo "[SUCCESS] resign IPA"