-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathutils.sh
72 lines (58 loc) · 1.61 KB
/
utils.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
64
65
66
67
68
69
70
71
72
#!/usr/bin/env bash
# Read the buildozer.spec file and extract version and package.domain
APP_VERSION=$(grep "version =" buildozer.spec | awk -F "=" '{print $2}' | tr -d '[:space:]')
APP_NAME=$(grep "package.name =" buildozer.spec | awk -F "=" '{print $2}' | tr -d '[:space:]')
BIN='bin'
ANDROID_SDK_DIR=~/.buildozer/android/platform/android-sdk
PACKAGE=fr.odrevet.$APP_NAME
BUILD_TOOLS_VERSION='35.0.0-rc2'
BUILD_TOOLS_DIR=$ANDROID_SDK_DIR/build-tools/$BUILD_TOOLS_VERSION
TARGET_ARCH=arm64-v8a
usage() {
echo "arguments: "
echo "--build"
echo "--sign"
echo "--install"
}
while true; do
action=$1
echo $action
case "$1" in
--build)
shift
buildozer android release
;;
--sign)
shift
if [[ $1 != --* ]]; then
KEYSTORE=$1
shift
else
KEYSTORE=mykeystore.keystore
fi
if [[ $1 != --* ]]; then
PASS=$1
shift
else
PASS=123456
fi
RELEASE_UNSIGNED=$BIN/$APP_NAME-$APP_VERSION-$TARGET_ARCH-release-unsigned.apk
RELEASE_ALIGNED=$BIN/$APP_NAME-aligned-unsigned.apk
OUT=$BIN/$APP_NAME.apk
$BUILD_TOOLS_DIR/zipalign -v -f -p 4 $RELEASE_UNSIGNED $RELEASE_ALIGNED
$BUILD_TOOLS_DIR/apksigner sign --ks $KEYSTORE --ks-pass pass:"$PASS" --out $OUT $RELEASE_ALIGNED
;;
--install)
shift
$PLATEFORM_TOOLS_DIR=$ANDROID_SDK_DIR/platform-tools
$PLATEFORM_TOOLS_DIR/adb uninstall $PACKAGE
$PLATEFORM_TOOLS_DIR/adb install $BIN/$APP_NAME.apk
;;
--logcat)
shift
$PLATEFORM_TOOLS_DIR=$ANDROID_SDK_DIR/platform-tools
$PLATEFORM_TOOLS_DIR/adb logcat | grep $PACKAGE
;;
*) break ;;
esac
done