1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:17:35 +00:00

Ports: Do not perform slow curl check if download already exists

Even if the file was already downloaded, we were trying to perform a
relatively slow HTTPS-call.
This commit is contained in:
Jelle Raaijmakers 2023-07-05 14:04:26 +02:00 committed by Linus Groh
parent d7a2b5e65b
commit 7551666a80

View file

@ -299,6 +299,11 @@ do_download_file() {
local filename="$2" local filename="$2"
local accept_existing="${3:-true}" local accept_existing="${3:-true}"
if $accept_existing && [ -f "$filename" ]; then
echo "$filename already exists"
return
fi
echo "Downloading URL: ${url}" echo "Downloading URL: ${url}"
# FIXME: Serenity's curl port does not support https, even with openssl installed. # FIXME: Serenity's curl port does not support https, even with openssl installed.
@ -306,16 +311,11 @@ do_download_file() {
url=$(echo "$url" | sed "s/^https:\/\//http:\/\//") url=$(echo "$url" | sed "s/^https:\/\//http:\/\//")
fi fi
# download files
if $accept_existing && [ -f "$filename" ]; then
echo "$filename already exists"
else
if which curl; then if which curl; then
run_nocd curl ${curlopts:-} "$url" -L -o "$filename" run_nocd curl ${curlopts:-} "$url" -L -o "$filename"
else else
run_nocd pro "$url" > "$filename" run_nocd pro "$url" > "$filename"
fi fi
fi
} }
fetch() { fetch() {