Created
November 25, 2025 04:13
-
-
Save beucismis/7efecc0a5c8e4c2681064789c591ef09 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| PACKAGE_LIST_FILE="fdroid_packages.txt" | |
| DOWNLOAD_DIR="fdroid_apks" | |
| check_dependency() { | |
| command -v "$1" >/dev/null 2>&1 || { | |
| echo >&2 "Error: '$1' command not found. Please install it." | |
| exit 1 | |
| } | |
| } | |
| download_package() { | |
| local package_name="$1" | |
| fdroidcl download "$package_name" > /dev/null 2>&1 | |
| if [ $? -eq 0 ]; then | |
| echo "[Download] Success: $package_name" | |
| else | |
| echo "[Download] Failed: $package_name (Could not download or find)." | |
| fi | |
| } | |
| echo "Starting F-Droid Parallel Download Script..." | |
| echo "------------------------------------------------" | |
| check_dependency "fdroidcl" | |
| check_dependency "adb" | |
| if [ ! -f "$PACKAGE_LIST_FILE" ]; then | |
| echo "Error: Package list file not found: '$PACKAGE_LIST_FILE'" | |
| exit 1 | |
| fi | |
| echo "Updating F-Droid repositories..." | |
| fdroidcl update | |
| if [ $? -ne 0 ]; then | |
| echo "Error: fdroidcl update failed. Exiting." | |
| exit 1 | |
| fi | |
| mkdir -p "$DOWNLOAD_DIR" | |
| echo "Downloading packages in parallel to '$DOWNLOAD_DIR'..." | |
| cd "$DOWNLOAD_DIR" || exit 1 | |
| while IFS= read -r package_name || [[ -n "$package_name" ]]; do | |
| package_name=$(echo "$package_name" | xargs) | |
| if [ -z "$package_name" ]; then | |
| continue | |
| fi | |
| echo "[Download] Starting: $package_name" | |
| download_package "$package_name" & | |
| done < "../$PACKAGE_LIST_FILE" | |
| wait | |
| echo "------------------------------------------------" | |
| echo "Checking ADB connection..." | |
| adb devices | grep -q 'device$' | |
| if [ $? -ne 0 ]; then | |
| echo "Error: ADB device not connected or unauthorized. Please authorize the connection on your phone." | |
| exit 1 | |
| fi | |
| echo "Starting sequential ADB installation..." | |
| for apk_file in *.apk; do | |
| if [ -f "$apk_file" ]; then | |
| package_name=$(echo "$apk_file" | sed -E 's/([^_]+).*?\.apk/\1/') | |
| echo "[Install] Starting: $package_name" | |
| adb install "$apk_file" | |
| if [ $? -eq 0 ]; then | |
| echo "[Install] Success: $package_name. Deleting local APK..." | |
| rm "$apk_file" | |
| else | |
| echo "[Install] Failed: $package_name. Keeping APK for debugging: $apk_file" | |
| fi | |
| fi | |
| done | |
| echo "------------------------------------------------" | |
| echo "Script finished. Check your phone for installed apps." | |
| cd .. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment