#!/bin/sh # shellcheck disable=SC1091 # Included files should be manually checked set -e # Pipefail is part of POSIX.1-2024, however some shells haven't # implemented it yet. Turn it on only if it's available. # shellcheck disable=SC3040 if (set -o pipefail 2>/dev/null); then set -o pipefail fi _SCRIPT_PATH="$(dirname "$(readlink -f -- "$0")")" . "$_SCRIPT_PATH"/_common.sh . "$_SCRIPT_PATH"/_sources/_index.sh _FILTER="$1" if [ "$_FILTER" = "help" ]; then cat <&2 return $exitcode fi return $exitcode } echo "Downloading with filter ${_FILTER:-""}..." _parse_downloads | while read -r path; read -r type; read -r args; do echo "> $path" if ! check_path "$path"; then echo "Bailing!" exit 1 fi debug "download_type: type=$type; args=$args" echo "$args" | download_type "$type" "$path" done