chore(imagesfiles): Refactor script introducing fetch_source function

Update options preferring their more explicit long form:
`-f` is `--fail`
`-s` is `--silent`
`-S` is `--show-error`
`-L` is `--location`

Additionally, `-O` is removed in favor of explicitly specifying the output file using `-o`
This commit is contained in:
Jean-Christophe Fillion-Robin
2025-08-27 11:08:53 -04:00
parent 0a27819132
commit 9f4e0b7413
6 changed files with 75 additions and 78 deletions
+17
View File
@@ -22,3 +22,20 @@ function check_sha256sum {
rm -f ${fname}.sha256
}
function fetch_source {
if ! command -v curl &> /dev/null; then
echo >&2 'error: "curl" not found!'
exit 1
fi
local file=$1
check_var "${file}"
local url=$2
check_var "${url}"
curl --fail \
--location \
--silent \
--show-error \
--connect-timeout 30 --max-time 10 \
--retry 5 --retry-delay 10 --retry-max-time 30 \
-o "${file}" ${url}/${file}
}