docker/fdroid/scripts/get_apks.sh

40 lines
823 B
Bash
Executable File

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