Add fdroid build script helpers

This commit is contained in:
Leendert de Borst
2025-11-03 17:55:01 +01:00
parent 376d38ef07
commit e7baadda9f
3 changed files with 31 additions and 1 deletions

View File

@@ -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

View File

@@ -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