Skip to content

Instantly share code, notes, and snippets.

@iOS0x00
Last active December 17, 2015 04:39
Show Gist options
  • Save iOS0x00/5552561 to your computer and use it in GitHub Desktop.
Save iOS0x00/5552561 to your computer and use it in GitHub Desktop.
更新apk版本的脚本, 支持release和deubg双线分支。
#!/bin/bash
if [[ -z $1 ]] & [[ -z $2 ]];then
echo "Usage: ./update.sh [release|debug] [vercode]"
exit 1
fi
curver=`tail -1 APKVERSION`
curverDebug=`tail -1 APKVERSION_DEBUG`
mode=$1
ver=$2
if [ "$mode" = "release" ]; then
if [ $curver -gt $ver ] & [ $curver -eq $ver ];then
echo "Reversal update, cancel"
exit 3
fi
cp -fv static/PPK_Device-ver$ver.apk static/ppk-lastest.apk
elif [ "$mode" = "debug" ]; then
if [ $curverDebug -gt $ver ] & [ $curverDebug -eq $ver ];then
echo "Reversal update, cancel"
exit 3
fi
cp -fv static/PPK_Device-ver"$ver"beta.apk static/ppk-debug-lastest.apk
else
echo "Unrecorigze mode"
exit 4
fi
renew=$?
if [ $renew != 0 ]; then
echo "Renew lastest apk failed"
exit 2
fi
if [ "$mode" = "release" ]; then
echo $ver >> APKVERSION
elif [ "$mode" = "debug" ]; then
echo $ver >> APKVERSION_DEBUG
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment