没办法,公司要弄重签名脚本,每次都是打企业包,不喜欢archieve,每次build之后,直接通过itunes上面找到xx.app,然后通过命令行脚本调用,进行打包,以下是关建行代码
#!/bin/sh
channelList="channelList.txt"
check_file "${app_name}.mobileprovision"
rm_dir "Payload"
rm_dir "out"
check_file "${app_name}.ipa"
unzip "${app_name}.ipa" > /dev/null
app_dir=$(find Payload/*.app -type d -name *.app)
check_dir "${app_dir}"
mkdir out
cp -f "${app_name}.mobileprovision" "${app_dir}/embedded.mobileprovision"
if [ $app_bundleId ]; then
echo "Set :CFBundleIdentifier ${app_bundleId}"
/usr/libexec/PlistBuddy -c 'Set :CFBundleIdentifier ""' "${app_dir}/info.plist"
fi
/usr/libexec/PlistBuddy -x -c "print :Entitlements " /dev/stdin <<< $(security cms -D -i ${app_name}.mobileprovision) > "${app_name}_entitlements.plist"
#/usr/libexec/PlistBuddy -c 'Set :get-task-allow true' "${app_name}_entitlements.plist"
resignFrameworks
check_file "${channelList}"
for channel in $(cat ${channelList})
do
if [ -n "$channel" ] ;then
rm_dir "${app_dir}/_CodeSignature"
#echo "${channel}\c" > "${app_dir}/.channel.dat"
recodesign ${app_dir}
#codesign -f -s "${certifierName}" --entitlements "${app_name}_entitlements.plist" ${app_dir}
zip -r "out/${app_name}_${channel}.ipa" "Payload" > /dev/null
if [ ! -f "out/${app_name}_${channel}.ipa" ]; then
echo "${app_name}_${channel}.ipa error \r\n"
else
echo "${app_name}_${channel}.ipa ok \r\n"
fi
fi
done
rm "${app_name}_entitlements.plist"
rm directories.txt
rm_dir "Payload"