SOURCEAPK="./AxureViewer.apk"
SOURCEWWW="./www"
BASEDIR="."
计算时间戳
DATETIME="$(/bin/date +%Y%m%d%H%M%S)"设置工作路径
WORKINGDIR="${BASEDIR}/${DATETIME}"
/bin/mkdir "${WORKINGDIR}"
cp "${SOURCEAPK}" "${WORKINGDIR}/source.apk"
/usr/local/bin/7za x -o"${WORKINGDIR}/source" "${WORKINGDIR}/source.apk"
rm -r "${WORKINGDIR}/source/META-INF"
/bin/mkdir "${WORKINGDIR}/source/assets/www"
cp -r "${SOURCEWWW}/"* "${WORKINGDIR}/source/assets/www"
/usr/local/php/bin/php ./rename.php "${WORKINGDIR}/source/assets/www"
/usr/local/bin/7za a -tzip "${WORKINGDIR}/unsigned.apk" "${WORKINGDIR}/source/*"
/usr/bin/keytool -genkeypair -keystore "${WORKINGDIR}/keystore" -storepass "${DATETIME}" -dname "CN=${DATETIME}, OU=hpx-party.net, O=daonao.com, L=Beijing, L=Beijing, C=CN" -alias "${DATETIME}" -keypass "${DATETIME}"
/usr/bin/jarsigner -keystore "${WORKINGDIR}/keystore" -storepass "${DATETIME}" -keypass "${DATETIME}" -digestalg SHA1 -signedjar "${WORKINGDIR}/signed.apk" "${WORKINGDIR}/unsigned.apk" "${DATETIME}
SOURCEAPK="./AxureViewer.apk" SOURCEWWW="./www" BASEDIR="." DATETIME="$(/bin/date +%Y%m%d%H%M%S)" WORKINGDIR="${BASEDIR}/${DATETIME}" /bin/mkdir "${WORKINGDIR}" cp "${SOURCEAPK}" "${WORKINGDIR}/source.apk" /usr/local/bin/7za x -o"${WORKINGDIR}/source" "${WORKINGDIR}/source.apk" rm -r "${WORKINGDIR}/source/META-INF" /bin/mkdir "${WORKINGDIR}/source/assets/www" cp -r "${SOURCEWWW}/"* "${WORKINGDIR}/source/assets/www" /usr/local/php/bin/php ./rename.php "${WORKINGDIR}/source/assets/www" /usr/local/bin/7za a -tzip "${WORKINGDIR}/unsigned.apk" "${WORKINGDIR}/source/*" /usr/bin/keytool -genkeypair -keystore "${WORKINGDIR}/keystore" -storepass "${DATETIME}" -dname "CN=${DATETIME}, OU=hpx-party.net, O=daonao.com, L=Beijing, L=Beijing, C=CN" -alias "${DATETIME}" -keypass "${DATETIME}" /usr/bin/jarsigner -keystore "${WORKINGDIR}/keystore" -storepass "${DATETIME}" -keypass "${DATETIME}" -digestalg SHA1 -signedjar "${WORKINGDIR}/signed.apk" "${WORKINGDIR}/unsigned.apk" "${DATETIME}"
在虚拟机中的效果如图所示