From 85aeaa4642d7461c62d290655b86c9043071d63a Mon Sep 17 00:00:00 2001
From: dmitry <dmitry.puzyrkov@demlabs.net>
Date: Mon, 23 Sep 2024 15:13:44 +0700
Subject: [PATCH] ...

---
 packaging/android.sh | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/packaging/android.sh b/packaging/android.sh
index dd9493e..d364f65 100644
--- a/packaging/android.sh
+++ b/packaging/android.sh
@@ -19,6 +19,27 @@ RDIR=$( dirname "$SOURCE" )
 DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
 HERE="$DIR"
 
+#check if we can sign apk
+APK_SIGN_POSSIBLE=1
+if [ -z "$ANDROID_KEYSTORE_PATH" ]
+then
+      echo "No ANDROID_KEYSTORE_PATH provided. APK will NOT be signed"
+      APK_SIGN_POSSIBLE=0
+fi
+
+if [ -z "$ANDROID_KEYSTORE_ALIAS" ]
+then
+      echo "No ANDROID_KEYSTORE_ALIAS provided. APK will NOT be signed"
+      APK_SIGN_POSSIBLE=0
+fi
+
+if [ -z "$ANDROID_KEYSTORE_PASS" ]
+then
+    echo "No ANDROID_KEYSTORE_PASS provided. APK will NOT be signed"
+    APK_SIGN_POSSIBLE=0
+fi
+
+
 
 FILL_VERSION()
 {
@@ -46,4 +67,8 @@ PACK()
 
     cd $HERE/../../os/android
     ./gradlew assembleRelease
+
+    if [ "$APK_SIGN_POSSIBLE" -eq "1" ]; then
+        apksigner sign --ks-key-alias $ANDROID_KEYSTORE_ALIAS --ks $ANDROID_KEYSTORE_PATH --ks-pass pass:"$ANDROID_KEYSTORE_PASS" --in ./app/build/outputs/apk/release/app-release.apk --out ../../CellframeNode.apk
+    fi
 }
-- 
GitLab