From 52c10d7223fc41f88e43924603616c1a962a27e6 Mon Sep 17 00:00:00 2001 From: Julian Mutter Date: Sun, 21 Jun 2026 13:21:28 +0200 Subject: [PATCH] Improve update scripts --- hosting/update.sh | 3 ++- scripts/apk-update-scripts/sheetless.sh | 6 ++---- scripts/update-apks.sh | 22 +++++++++------------- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/hosting/update.sh b/hosting/update.sh index acaad9314..79479d01a 100755 --- a/hosting/update.sh +++ b/hosting/update.sh @@ -14,12 +14,13 @@ if [ ! -d "./code/.git" ]; then cd ./code ./scripts/decrypt.sh echo "Done" +else + cd "./code" fi echo "Running regular repo update..." echo "" -cd "./code" git fetch origin LOCAL=$(git rev-parse HEAD) REMOTE=$(git rev-parse "origin/$BRANCH") diff --git a/scripts/apk-update-scripts/sheetless.sh b/scripts/apk-update-scripts/sheetless.sh index 6e1e9f215..a475b8c67 100755 --- a/scripts/apk-update-scripts/sheetless.sh +++ b/scripts/apk-update-scripts/sheetless.sh @@ -9,8 +9,7 @@ REPO_OWNER="julian" REPO_NAME="sheetless" APP_NAME="de.frajul.sheetless" TARGET_ASSET_NAME="app-release.apk" -FDROID_REPO_DIR="./fdroid/repo" -FDROID_ARCHIVE_DIR="./fdroid/archive" +APK_DIR="/apks" # ========================================== # SETUP & API CALL @@ -44,8 +43,7 @@ while IFS=$'\t' read -r TAG DOWNLOAD_URL; do # Skip empty lines if jq returns nothing [[ -z "$TAG" ]] && continue - LOCAL_FILE="$FDROID_REPO_DIR/${APP_NAME}_${TAG}.apk" - ARCHIVE_FILE="$FDROID_ARCHIVE_DIR/${APP_NAME}_${TAG}.apk" + LOCAL_FILE="$APK_DIR/${APP_NAME}_${TAG}.apk" echo "Checking release: $TAG..." diff --git a/scripts/update-apks.sh b/scripts/update-apks.sh index 500c7089b..1db46ecf8 100755 --- a/scripts/update-apks.sh +++ b/scripts/update-apks.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -CHANGES_PRODUCED=false - # Put here all apk update scripts UPDATE_SCRIPTS=( "./scripts/apk-update-scripts/sheetless.sh" @@ -10,23 +8,21 @@ UPDATE_SCRIPTS=( for script in "${UPDATE_SCRIPTS[@]}"; do echo "--------------------------------" echo "Executing: $script" - + # Run the script $script - - # Capture the exit code immediately - if [ $? -eq 10 ]; then - echo " -> $script returned 10 (change)" - CHANGES_PRODUCED=true - fi done -echo "--------------------------------" +# Sync all apks from the mounted dir to dest +SOURCE="/apks/" +DEST="/src/code/fdroid/repo/" +OUTPUT=$(rsync -avi --include="*.apk" --exclude="*" --delete "$SOURCE" "$DEST") -if [ "$CHANGES_PRODUCED" = true ]; then - echo "Result: At least one script produced a change" +# Check if the output contains the specific tags for new files (>f) or deleted files (*deleting) +if echo "$OUTPUT" | grep -q -E '^>f|^\*deleting'; then + echo "Changes detected! Files were copied or deleted." exit 10 else - echo "Result: Not script produced a change" + echo "No APKs were added or removed. Skipping F-Droid update." exit 0 fi