#!/bin/bash -e SCRIPT_PATH="$(dirname "$0")" function get_links() { FILE="$1" awk 'NF && $1!~/^#/' "$FILE" | while read -r URL; do case "$URL" in *github.com*) "$SCRIPT_PATH/get_github_dl_links.sh" "$URL" ;; *gitlab.com*) "$SCRIPT_PATH/get_gitlab_dl_links.sh" "$URL" ;; *) ;; esac done } LINKS="$(get_links apks.txt)" (cd /repo/ xargs -n1 -P8 curl -LO <<< "$LINKS" fdroid update -c ) if [ -n "$PUID" ]; then chown -R "$PUID:$PGID" /repo/ fi