Created
May 13, 2017 09:11
-
-
Save yuchuanfeng/a46cf03535e30b30e72d6976f8847c3b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#set -e | |
BUNDLEIDENTIFIER=come.tencent.xin | |
APPLICATIONIDENTIFIER=***.${BUNDLEIDENTIFIER} | |
ORIGINDIR=$(pwd) | |
FILEPATH=***/WeChat | |
TEMPDIR=$(mktemp -d) | |
ObjectPath=$BUILT_PRODUCTS_DIR | |
LIBNAME=$ORIGINDIR | |
AppName=WeChat | |
DataName=WeChat | |
echo "origindir === $ORIGINDIR ====" | |
echo "ObjectPath === $ObjectPath ===" | |
echo "appName ==== $AppName =====" | |
echo "DataName ==== $DataName =====" | |
function handleFiles(){ | |
# 1.unzip ipa | |
cp -r ${FILEPATH}/$AppName.app $TEMPDIR/$AppName.app | |
# 2.copy files | |
cp ${FILEPATH}/embedded.mobileprovision $TEMPDIR/ | |
cp ${FILEPATH}/entitlements.plist $TEMPDIR/ | |
cp yololib $TEMPDIR/ | |
cd $ObjectPath | |
LIBNAME=$(find *.dylib -maxdepth 1) | |
cp ${LIBNAME} $TEMPDIR/ | |
echo "LibName === $LIBNAME ===" | |
} | |
function resign(){ | |
# 3.resign | |
cd $TEMPDIR | |
plutil -replace application-identifier -string ${APPLICATIONIDENTIFIER} entitlements.plist | |
plutil -replace CFBundleIdentifier -string ${BUNDLEIDENTIFIER} $AppName.app/Info.plist | |
./yololib ${AppName}.app/$DataName ${LIBNAME} | |
echo "yololib install success" | |
cp ${LIBNAME} $AppName.app/ | |
chmod +x $AppName.app/$DataName | |
rm -rf $AppName.app/_CodeSignature | |
rm -rf $AppName.app/PlugIns | |
cp embedded.mobileprovision $AppName.app/ | |
echo "start sign" | |
codesign -fs "iPhone Developer: chuanfeng yu (96JZJ353JM)" $AppName.app/${LIBNAME} | |
codesign -fs "iPhone Developer: chuanfeng yu (96JZJ353JM)" --entitlements=Entitlements.plist $AppName.app | |
echo "start sign" | |
} | |
function replaceFile(){ | |
echo "start move $WeChatObjectPath" | |
cd $ORIGINDIR | |
rm -rf $ObjectPath/$AppName.app | |
cd $TEMPDIR | |
mv $AppName.app ${ObjectPath} | |
rm -rf ${TEMPDIR} | |
echo "finish move $WeChatObjectPath" | |
} | |
if [ $LIBNAME != NULL ] | |
then | |
handleFiles | |
resign | |
replaceFile | |
# sh 00 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment