From 74f998e4553f13a2a9e3e9812b33fa1f44eba032 Mon Sep 17 00:00:00 2001 From: Felix Date: Fri, 23 May 2025 11:13:16 +0200 Subject: [PATCH] update.sh aktualisiert --- update.sh | 79 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 61 insertions(+), 18 deletions(-) diff --git a/update.sh b/update.sh index 0d49f11..f116513 100755 --- a/update.sh +++ b/update.sh @@ -7,6 +7,13 @@ rm -f repo/entry.jar # Make sure we have the tools we need command -v aapt >/dev/null 2>&1 || { echo "Error: aapt is required but not installed. Please install Android SDK build tools."; exit 1; } +command -v jq >/dev/null 2>&1 || { echo "Error: jq is required but not installed. Please install jq for JSON parsing."; exit 1; } + +# Configuration +GITEA_URL="https://git.felo.gg" +REPO_OWNER="FeloStore" +REPO_NAME="Data" +RELEASE_TAG="latest" # Function to extract version from APK get_version() { @@ -28,6 +35,13 @@ update_app() { # Download to temp file wget -q -O "./temp/${app_name}.apk.new" "$app_url" + # Check if download was successful + if [ ! -f "./temp/${app_name}.apk.new" ] || [ ! -s "./temp/${app_name}.apk.new" ]; then + echo " ✗ $app_name: Download failed, skipping..." + rm -f "./temp/${app_name}.apk.new" + return + fi + # Extract version info from the new APK new_version=$(get_version "./temp/${app_name}.apk.new") echo " Downloaded version: $new_version" @@ -54,25 +68,54 @@ update_app() { fi } -# Process each app -update_app "FeloStore" "https://git.felo.gg/FeloStore/Data/releases/download/latest/felostore.apk" -update_app "YouTube" "https://git.felo.gg/FeloStore/Data/releases/download/latest/youtube.apk" -update_app "Reddit" "https://git.felo.gg/FeloStore/Data/releases/download/latest/reddit.apk" -update_app "Duolingo" "https://git.felo.gg/FeloStore/Data/releases/download/latest/duolingo.apk" -update_app "Instagram" "https://git.felo.gg/FeloStore/Data/releases/download/latest/instagram.apk" -update_app "Twitter" "https://git.felo.gg/FeloStore/Data/releases/download/latest/twitter.apk" -update_app "NovaLauncher" "https://git.felo.gg/FeloStore/Data/releases/download/latest/novalauncher.apk" -update_app "Busuu" "https://git.felo.gg/FeloStore/Data/releases/download/latest/busuu.apk" -update_app "Quizlet" "https://git.felo.gg/FeloStore/Data/releases/download/latest/quizlet.apk" -update_app "Telegram" "https://git.felo.gg/FeloStore/Data/releases/download/latest/telegram.apk" -update_app "Yazio" "https://git.felo.gg/FeloStore/Data/releases/download/latest/yazio.apk" -update_app "WetterOnline" "https://git.felo.gg/FeloStore/Data/releases/download/latest/wetteronline.apk" -update_app "CapCut" "https://git.felo.gg/FeloStore/Data/releases/download/latest/capcut.apk" -update_app "GuitarTuna" "https://git.felo.gg/FeloStore/Data/releases/download/latest/guitartuna.apk" -update_app "Yuka" "https://git.felo.gg/FeloStore/Data/releases/download/latest/yuka.apk" +# Function to get app name from filename +get_app_name() { + filename=$1 + # Remove .apk extension and convert to proper case + app_name=$(basename "$filename" .apk) + # Convert first letter to uppercase + app_name=$(echo "$app_name" | sed 's/^\(.\)/\U\1/') + echo "$app_name" +} + +echo "Fetching release information from Gitea..." + +# Get release information from Gitea API +RELEASE_API_URL="${GITEA_URL}/api/v1/repos/${REPO_OWNER}/${REPO_NAME}/releases/tags/${RELEASE_TAG}" +release_info=$(wget -q -O - "$RELEASE_API_URL") + +if [ -z "$release_info" ]; then + echo "Error: Could not fetch release information from Gitea API" + exit 1 +fi + +# Extract APK download URLs from the release +apk_urls=$(echo "$release_info" | jq -r '.assets[] | select(.name | endswith(".apk")) | .browser_download_url') + +if [ -z "$apk_urls" ]; then + echo "Error: No APK files found in the latest release" + exit 1 +fi + +echo "Found APK files in release:" +echo "$apk_urls" | while read -r url; do + filename=$(basename "$url") + echo " - $filename" +done + +# Process each APK +echo "$apk_urls" | while read -r url; do + if [ -n "$url" ]; then + filename=$(basename "$url") + app_name=$(get_app_name "$filename") + update_app "$app_name" "$url" + fi +done # Clean up temp directory rm -rf ./temp -# Update the F-Droid repository -/root/.local/bin/fdroid update --clean --allow-disabled-algorithms \ No newline at end of file +echo "Updating F-Droid repository..." +/root/.local/bin/fdroid update --clean --allow-disabled-algorithms + +echo "Done! Repository updated with all available apps." \ No newline at end of file