#!/usr/bin/env bash # Generate a release signing keystore for the Android APK (run ONCE), then print # the base64 + values to paste into Forgejo repo secrets. Keep the keystore file # safe and constant forever — losing it or changing it breaks Obtainium updates # (a differently-signed APK will not install over the old one). set -euo pipefail KEYSTORE="${1:-campscan-release.keystore}" ALIAS="${2:-campscan}" if [ -f "$KEYSTORE" ]; then echo "Refusing to overwrite existing $KEYSTORE" >&2 exit 1 fi read -r -s -p "Choose a keystore password: " STOREPASS; echo read -r -s -p "Confirm keystore password: " STOREPASS2; echo [ "$STOREPASS" = "$STOREPASS2" ] || { echo "Passwords do not match" >&2; exit 1; } keytool -genkeypair -v \ -keystore "$KEYSTORE" \ -alias "$ALIAS" \ -keyalg RSA -keysize 2048 -validity 10000 \ -storepass "$STOREPASS" -keypass "$STOREPASS" \ -dname "CN=Beartaria Campgrounds, OU=Gate, O=Beartaria, L=, ST=, C=US" echo echo "==================== Forgejo repo secrets ====================" echo "Set these under: git.mowden.top -> CampgroundTickets -> Settings -> Actions -> Secrets" echo echo "ANDROID_KEY_ALIAS = $ALIAS" echo "ANDROID_KEYSTORE_PASSWORD = (the password you just entered)" echo "ANDROID_KEY_PASSWORD = (the same password)" echo "ANDROID_KEYSTORE_B64 = (paste the block below, single line)" echo base64 -w0 "$KEYSTORE"; echo echo "=============================================================" echo "Store $KEYSTORE somewhere safe and OFF this repo (it is git-ignored)."