From e7baadda9f7b503aab14812e0dfcac2d09fa3cf0 Mon Sep 17 00:00:00 2001 From: Leendert de Borst Date: Mon, 3 Nov 2025 17:55:01 +0100 Subject: [PATCH] Add fdroid build script helpers --- .../android/fdroid/docker-compose.yml | 2 +- apps/mobile-app/android/fdroid/run.sh | 30 +++++++++++++++++++ .../android/fdroid/{ => scripts}/build.sh | 0 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100755 apps/mobile-app/android/fdroid/run.sh rename apps/mobile-app/android/fdroid/{ => scripts}/build.sh (100%) diff --git a/apps/mobile-app/android/fdroid/docker-compose.yml b/apps/mobile-app/android/fdroid/docker-compose.yml index 8faf6c796..903eefbbc 100644 --- a/apps/mobile-app/android/fdroid/docker-compose.yml +++ b/apps/mobile-app/android/fdroid/docker-compose.yml @@ -13,7 +13,7 @@ services: # Overwrite the net.aliasvault.app.yml file with the local one which forces build to use latest commit from main branch - ./net.aliasvault.app.yml:/build/metadata/net.aliasvault.app.yml # Add build script to the container - - ./build.sh:/build.sh:Z + - ./scripts/build.sh:/build.sh:Z # Increase memory limits for Gradle builds shm_size: '2gb' mem_limit: 12g diff --git a/apps/mobile-app/android/fdroid/run.sh b/apps/mobile-app/android/fdroid/run.sh new file mode 100755 index 000000000..a0155d110 --- /dev/null +++ b/apps/mobile-app/android/fdroid/run.sh @@ -0,0 +1,30 @@ +#!/bin/bash +set -e # Exit on any error, except where explicitly ignored +trap 'echo "🛑 Interrupted. Exiting..."; exit 130' INT # Handle Ctrl+C cleanly + +# Function to safely clone or update a repo +clone_or_update() { + local repo_url=$1 + local dir_name=$(basename "$repo_url" .git) + + if [ -d "$dir_name/.git" ]; then + echo "Updating existing repository: $dir_name" + git -C "$dir_name" pull origin master || echo "⚠️ Warning: Failed to pull updates for $dir_name, continuing..." + else + echo "Cloning repository: $repo_url" + git clone --depth=1 "$repo_url" "$dir_name" || echo "⚠️ Warning: Failed to clone $repo_url, continuing..." + fi +} + +# Clone or update both repositories +clone_or_update "https://gitlab.com/fdroid/fdroiddata.git" +clone_or_update "https://gitlab.com/fdroid/fdroidserver.git" + +# Build and run the Docker environment +echo "Building Docker images..." +if ! docker compose build; then + echo "⚠️ Warning: Docker build failed, continuing..." +fi + +echo "Running fdroid-buildserver..." +docker compose run --rm fdroid-buildserver \ No newline at end of file diff --git a/apps/mobile-app/android/fdroid/build.sh b/apps/mobile-app/android/fdroid/scripts/build.sh similarity index 100% rename from apps/mobile-app/android/fdroid/build.sh rename to apps/mobile-app/android/fdroid/scripts/build.sh