ios ipa(包含frameworks)重新签名

废话不多说,直接上图,上代码

ios ipa(包含frameworks)重新签名_第1张图片


以下是 脚本内容

resignRoot=$PWD

certfierName="XXXXXXXXXXXXXXX"

appFolder="XXXXXXXXXXXXXXX"

echo "1. unpackage ipa"

rm -rf ./Payload

rm -rf resigned.ipa

unzip *.ipa >> resign.log

echo "finsh unpackage ipa"

# search app floder

for app_item in ./Payload/*.app

do

if test -d $app_item

then

appFolder=$app_item

fi

done

if [ ${appFolder}x != "x" ]; then

echo "Did found app:"$appFolder

else

echo "No ipa found."

rm -rf resign.log

exit

fi

# copy embedded.mobileprovision

echo "2. copy embedded.mobileprovision"

rm -rf ${appFolder}/embedded.mobileprovision

cp ./*.mobileprovision ${appFolder}/embedded.mobileprovision

cd ${appFolder}/

for zip_item in *.zip

do

unzip -q $zip_item

rm -rf $zip_item

done

cd $resignRoot

for bundle_item in ${appFolder}/*.framework

do

if test -d $bundle_item

then

cp ./*.mobileprovision ${bundle_item}/embedded.mobileprovision

fi

done

echo "3. export entitlements.plist"

rm -rf ./entitlements.plist

codesign -d --entitlements=entitlements.plist ${appFolder}

echo "4. resign app"

rm -rf ${appFolder}/Embedded.plist

cp ./Embedded.plist ${appFolder}/Embedded.plist

cd ${appFolder}/

for bundle_item in *.framework

do

if test -d $bundle_item

then

bunleName=${bundle_item%%.framework}

codesign -f -s "$certfierName" --entitlements=${resignRoot}/entitlements.plist ${bundle_item}

zip -q -r ${bunleName}.zip $bundle_item

rm -rf $bundle_item

fi

done

cd $resignRoot

for fmwk_item in ${appFolder}/Frameworks/*.framework

do

codesign -f -s "$certfierName" --entitlements=entitlements.plist ${fmwk_item}

done

codesign -f -s "$certfierName" --entitlements=entitlements.plist ${appFolder}

echo "5. package ipa ..."

zip -r resigned.ipa ./Payload/ >> resign.log

echo "6. clean ..."

rm -rf resign.log

rm -rf ./entitlements.plist

rm -rf ./Payload

echo "7. done."

你可能感兴趣的:(ios ipa(包含frameworks)重新签名)