Add Android control app and embedded server
Inspired by HNKServer/honoka-chan-apk-server, but implemented as a JNI-based embedded runtime instead of the original approach. - Add an Android Compose controller app that starts and stops honoka-chan through JNI, shows runtime and health status, manages data directory mounting, and supports backup import/export for data.db - Add an embeddable Go server entrypoint plus JNI-exported status, health, and reload hooks so desktop and Android builds share the same startup and shutdown path - Add Android build scripts, runtime packaging, and project documentation, including generated default config.json content for honoka_runtime.zip - Add runtime bundle hash tracking so updated honoka_runtime.zip assets are automatically redeployed while preserving config.json and user data files - Add in-app service settings for unlock_all_special_rotation with immediate config persistence and automatic reload when the service is running - Split SQLite driver selection by platform, using go-sqlite3 on Android and modernc.org/sqlite elsewhere to avoid Android x86_64 seccomp crashes - Update startup, database initialization, and system health/reload handlers to support the embedded runtime and Android control flow Signed-off-by: Sean Du <do4suki@gmail.com>
This commit is contained in:
Executable
+85
@@ -0,0 +1,85 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/common.sh"
|
||||
|
||||
ok() {
|
||||
printf '[android] ok: %s\n' "$*"
|
||||
}
|
||||
|
||||
warn() {
|
||||
printf '[android] warn: %s\n' "$*" >&2
|
||||
}
|
||||
|
||||
status=0
|
||||
|
||||
check_cmd() {
|
||||
local cmd="$1"
|
||||
if command -v "$cmd" >/dev/null 2>&1; then
|
||||
ok "command found: $cmd -> $(command -v "$cmd")"
|
||||
else
|
||||
warn "command missing: $cmd"
|
||||
status=1
|
||||
fi
|
||||
}
|
||||
|
||||
check_file() {
|
||||
local file="$1"
|
||||
if [[ -f "$file" ]]; then
|
||||
ok "file found: $file"
|
||||
else
|
||||
warn "file missing: $file"
|
||||
status=1
|
||||
fi
|
||||
}
|
||||
|
||||
check_dir() {
|
||||
local dir="$1"
|
||||
if [[ -d "$dir" ]]; then
|
||||
ok "directory found: $dir"
|
||||
else
|
||||
warn "directory missing: $dir"
|
||||
status=1
|
||||
fi
|
||||
}
|
||||
|
||||
log "checking common commands"
|
||||
check_cmd go
|
||||
check_cmd zip
|
||||
|
||||
SDK_ROOT="${ANDROID_SDK_ROOT:-${ANDROID_HOME:-}}"
|
||||
NDK_ROOT="${ANDROID_NDK_HOME:-${ANDROID_NDK_ROOT:-}}"
|
||||
HOST_TAG="${ANDROID_NDK_HOST_TAG:-linux-x86_64}"
|
||||
MIN_SDK="${MIN_SDK:-26}"
|
||||
|
||||
if [[ -n "$SDK_ROOT" ]]; then
|
||||
check_dir "$SDK_ROOT"
|
||||
else
|
||||
warn "ANDROID_SDK_ROOT is not set"
|
||||
status=1
|
||||
fi
|
||||
|
||||
if [[ -n "$NDK_ROOT" ]]; then
|
||||
check_dir "$NDK_ROOT"
|
||||
TOOLCHAIN="$NDK_ROOT/toolchains/llvm/prebuilt/$HOST_TAG/bin"
|
||||
check_dir "$TOOLCHAIN"
|
||||
check_file "$TOOLCHAIN/aarch64-linux-android${MIN_SDK}-clang"
|
||||
check_file "$TOOLCHAIN/armv7a-linux-androideabi${MIN_SDK}-clang"
|
||||
check_file "$TOOLCHAIN/x86_64-linux-android${MIN_SDK}-clang"
|
||||
else
|
||||
warn "ANDROID_NDK_HOME is not set"
|
||||
status=1
|
||||
fi
|
||||
|
||||
log "checking project files"
|
||||
check_file "$PROJECT_ROOT/assets/main.db"
|
||||
check_dir "$PROJECT_ROOT/assets/serverdata"
|
||||
check_dir "$PROJECT_ROOT/assets/certs"
|
||||
check_dir "$PROJECT_ROOT/static/templates"
|
||||
|
||||
if [[ $status -ne 0 ]]; then
|
||||
warn "environment check failed"
|
||||
exit $status
|
||||
fi
|
||||
|
||||
ok "environment check passed"
|
||||
Reference in New Issue
Block a user