mirror of
https://github.com/bensuperpc/dockcross.git
synced 2026-07-26 04:48:08 +02:00
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:
@@ -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}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user