update.sh aktualisiert

This commit is contained in:
2025-05-03 18:33:47 +02:00
parent b6867d42cd
commit 64122b4a87

View File

@@ -1,29 +1,18 @@
#!/bin/bash
cd /var/www/html || exit 1
# Fix permissions on config.yml if it exists
if [ -f config.yml ]; then
chmod 0600 config.yml
fi
# First, let's clear the F-Droid index
rm -f repo/index*
rm -f repo/entry.jar
# Create repo icon directory if it doesn't exist
mkdir -p repo/icons
# Create a basic repo icon if missing
if [ ! -f repo/icons/icon.png ]; then
echo "Creating placeholder repo icon..."
# Try to download a simple icon
wget -q -O repo/icons/icon.png "https://f-droid.org/assets/favicon-256.png" || echo "Could not create icon, please add one manually"
fi
# 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; }
# Function to extract version from APK (if aapt is available)
# Function to extract version from APK
get_version() {
apk_file=$1
if command -v aapt >/dev/null 2>&1; then
version=$(aapt dump badging "$apk_file" 2>/dev/null | grep versionName | awk -F"'" '{print $4}')
echo "$version"
else
echo "unknown (aapt not installed)"
fi
version=$(aapt dump badging "$apk_file" 2>/dev/null | grep versionName | awk -F"'" '{print $4}')
echo "$version"
}
# Function to download and update only if changed
@@ -39,13 +28,6 @@ update_app() {
# Download to temp file
wget -q -O "./temp/${app_name}.apk.new" "$app_url"
# Check if download was successful
if [ ! -s "./temp/${app_name}.apk.new" ]; then
echo " ✗ Failed to download $app_name, 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"
@@ -72,9 +54,6 @@ update_app() {
fi
}
# Make sure archive directory exists
mkdir -p archive/
# Process each app
update_app "YouTube" "https://github.com/FiorenMas/Revanced-And-Revanced-Extended-Non-Root/releases/download/all/youtube-revanced-extended.apk"
update_app "Reddit" "https://github.com/FiorenMas/Revanced-And-Revanced-Extended-Non-Root/releases/download/all/reddit-revanced-extended.apk"
@@ -91,29 +70,5 @@ update_app "Telegram" "https://git.felo.gg/FeloStore/Data/releases/download/late
# Clean up temp directory
rm -rf ./temp
# Add option to config to accept unsigned APKs
if [ -f config.yml ]; then
if ! grep -q "allow_disabled_algorithms:" config.yml; then
echo "allow_disabled_algorithms: True" >> config.yml
fi
fi
# Update F-Droid repository first with nosign to prevent signature verification issues
echo "Updating F-Droid repository with nosign first..."
fdroid update --allow-disabled-algorithms --use-date-from-apk --nosign
# Now check for archived APKs and restore them to repo
echo "Checking for archived APKs to restore..."
for app in YouTube Reddit SoundCloud Duolingo GoogleNews Instagram Twitter NovaLauncher Busuu Quizlet Telegram; do
if [ -f "archive/${app}.apk" ]; then
echo "Restoring ${app}.apk from archive to repo"
cp "archive/${app}.apk" "repo/${app}.apk"
touch -d "$(date +%Y-%m-%d)" "repo/${app}.apk"
fi
done
# Final update to ensure everything is included
echo "Running final update with metadata creation..."
fdroid update --allow-disabled-algorithms --use-date-from-apk --create-metadata --clean --nosign
echo "Update complete!"
# Update the F-Droid repository
fdroid update --clean