步骤一
拷贝代码到 your.sh 文件
#!/bin/sh
to_path=`dirname $0`
app_path=${1}
app_file=$(basename $app_path .app)
echo ${to_path}
echo ${app_path}
ipa_name="${app_file}.ipa"
if [ "${app_path##*.}" != "app" ];then
echo "${app_path} suffix is not app!!!";
exit 1;
fi
if [ ! -d "${app_path}" ];then
echo "${app_path} is not exsit!!!";
exit 1;
fi
zip_file="Payload"
if [ -d $zip_file ];then
rm -d $zip_file
fi
mkdir $zip_file
cp -af ${app_path} ${zip_file}
zip -r ${ipa_name} ${zip_file}
rm -rf $zip_file
mv -f ${ipa_name} ${to_path}
echo "ipa mv to ${to_path}/"
步骤二
chmod 777 your.sh
步骤三
终端输入:
your.sh app_path
会在your.sh的当前目录生成一个.ipa文件