forked from ModernizacionMuniCBA/Cuanto-tengo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
to-market.sh
executable file
·63 lines (51 loc) · 2.13 KB
/
to-market.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
echo " ******************************** "
echo "Cargar los valores de configuración ..."
echo " ******************************** "
source compiler-cfg.sh
# REFERENCIA
# export APPNAME=CuantoTengo
# export MKEY="xxxxxxxxxx"
# export MYSDKPATH=/home/user/android-sdk-linux
# export TOKENJS=xxxxxxxxxxxx
echo "Importado"
echo " -- APPNAME=${APPNAME}"
echo " -- MKEY=${MKEY}"
echo " -- MYSDKPATH=${MYSDKPATH}"
echo " -- TOKENJS=${TOKENJS}"
echo " ******************************** "
echo "Identificando la versión en config.xml ..."
echo " ******************************** "
# llevar la versión que definí en el config.xml a una variable de javascript
echo "/*AUTOGENERADO POR EL COMPILADOR*/" > www/version.js
cat config.xml \
| grep '^<widget' \
| sed 's|^.*version="\([^"]\+\)".*|var cordova_app_version = "\1";|' \
>> www/version.js
echo "var tokenAuth = '${TOKENJS}';" > www/js/credentials.js
export ANDROID_HOME=$MYSDKPATH
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
echo " ******************************** "
echo "Compilando local ..."
echo " ******************************** "
cordova build android --release
# Solo una vez, crear la llave
# keytool -genkey -v -keystore ${APPNAME}.keystore -alias ${APPNAME} -keyalg RSA -keysize 2048 -validity 10000
# queda en platforms/android/build/outputs/apk/android-release-unsigned.apk
echo " ******************************** "
echo "Compilando con key ..."
echo " ******************************** "
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 \
-keystore ${APPNAME}.keystore \
platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk \
${APPNAME} <<< $MKEY
echo " ******************************** "
echo "Limpiando APK anterior"
echo " ******************************** "
# borrar el anterior comppilado
rm platforms/android/app/build/outputs/apk/release/${APPNAME}.apk
echo " ******************************** "
echo "Alineado y balanceado"
echo " ******************************** "
zipalign -v 4 \
platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk \
platforms/android/app/build/outputs/apk/release/${APPNAME}.apk