Improve update scripts
This commit is contained in:
+2
-1
@@ -14,12 +14,13 @@ if [ ! -d "./code/.git" ]; then
|
|||||||
cd ./code
|
cd ./code
|
||||||
./scripts/decrypt.sh
|
./scripts/decrypt.sh
|
||||||
echo "Done"
|
echo "Done"
|
||||||
|
else
|
||||||
|
cd "./code"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Running regular repo update..."
|
echo "Running regular repo update..."
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
cd "./code"
|
|
||||||
git fetch origin
|
git fetch origin
|
||||||
LOCAL=$(git rev-parse HEAD)
|
LOCAL=$(git rev-parse HEAD)
|
||||||
REMOTE=$(git rev-parse "origin/$BRANCH")
|
REMOTE=$(git rev-parse "origin/$BRANCH")
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ REPO_OWNER="julian"
|
|||||||
REPO_NAME="sheetless"
|
REPO_NAME="sheetless"
|
||||||
APP_NAME="de.frajul.sheetless"
|
APP_NAME="de.frajul.sheetless"
|
||||||
TARGET_ASSET_NAME="app-release.apk"
|
TARGET_ASSET_NAME="app-release.apk"
|
||||||
FDROID_REPO_DIR="./fdroid/repo"
|
APK_DIR="/apks"
|
||||||
FDROID_ARCHIVE_DIR="./fdroid/archive"
|
|
||||||
|
|
||||||
# ==========================================
|
# ==========================================
|
||||||
# SETUP & API CALL
|
# SETUP & API CALL
|
||||||
@@ -44,8 +43,7 @@ while IFS=$'\t' read -r TAG DOWNLOAD_URL; do
|
|||||||
# Skip empty lines if jq returns nothing
|
# Skip empty lines if jq returns nothing
|
||||||
[[ -z "$TAG" ]] && continue
|
[[ -z "$TAG" ]] && continue
|
||||||
|
|
||||||
LOCAL_FILE="$FDROID_REPO_DIR/${APP_NAME}_${TAG}.apk"
|
LOCAL_FILE="$APK_DIR/${APP_NAME}_${TAG}.apk"
|
||||||
ARCHIVE_FILE="$FDROID_ARCHIVE_DIR/${APP_NAME}_${TAG}.apk"
|
|
||||||
|
|
||||||
echo "Checking release: $TAG..."
|
echo "Checking release: $TAG..."
|
||||||
|
|
||||||
|
|||||||
+9
-13
@@ -1,7 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
CHANGES_PRODUCED=false
|
|
||||||
|
|
||||||
# Put here all apk update scripts
|
# Put here all apk update scripts
|
||||||
UPDATE_SCRIPTS=(
|
UPDATE_SCRIPTS=(
|
||||||
"./scripts/apk-update-scripts/sheetless.sh"
|
"./scripts/apk-update-scripts/sheetless.sh"
|
||||||
@@ -10,23 +8,21 @@ UPDATE_SCRIPTS=(
|
|||||||
for script in "${UPDATE_SCRIPTS[@]}"; do
|
for script in "${UPDATE_SCRIPTS[@]}"; do
|
||||||
echo "--------------------------------"
|
echo "--------------------------------"
|
||||||
echo "Executing: $script"
|
echo "Executing: $script"
|
||||||
|
|
||||||
# Run the script
|
# Run the script
|
||||||
$script
|
$script
|
||||||
|
|
||||||
# Capture the exit code immediately
|
|
||||||
if [ $? -eq 10 ]; then
|
|
||||||
echo " -> $script returned 10 (change)"
|
|
||||||
CHANGES_PRODUCED=true
|
|
||||||
fi
|
|
||||||
done
|
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
|
# Check if the output contains the specific tags for new files (>f) or deleted files (*deleting)
|
||||||
echo "Result: At least one script produced a change"
|
if echo "$OUTPUT" | grep -q -E '^>f|^\*deleting'; then
|
||||||
|
echo "Changes detected! Files were copied or deleted."
|
||||||
exit 10
|
exit 10
|
||||||
else
|
else
|
||||||
echo "Result: Not script produced a change"
|
echo "No APKs were added or removed. Skipping F-Droid update."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user