mirror of
git://code.qt.io/qt/qt5.git
synced 2025-12-21 07:28:21 +08:00
Unix: Add curl fallback to check_and_set_proxy.sh
This script is stored in the directory 'provisioning/common/unix'. This implies it can be used from Linux and macOS hosts. The script uses the wget command, but at the time of writing, wget is not installed on our macOS hosts. If wget is not found, this command will assume the HTTP proxy is not found rather than fail the script execution. This patch rewrites this script to use curl if wget is not found. This makes it run correctly on macOS. Additionally, it adds a fail case if neither wget or curl is found on the system. Pick-to: 6.11 6.10 6.8 Change-Id: Id54b9fc69307ef28eb35cf1c0042df11e704a6e2 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
This commit is contained in:
committed by
Nils Petter Skålerud
parent
f0b54a51f7
commit
bc6ba67934
@@ -7,4 +7,22 @@ set -ex
|
|||||||
# shellcheck source=../shared/http_proxy.txt
|
# shellcheck source=../shared/http_proxy.txt
|
||||||
source "${BASH_SOURCE%/*}/../shared/http_proxy.txt"
|
source "${BASH_SOURCE%/*}/../shared/http_proxy.txt"
|
||||||
|
|
||||||
{ wget -q -e "http_proxy=$proxy" --spider proxy.intra.qt.io && echo "Setting http_proxy to $proxy" && export http_proxy=$proxy; } || echo "Proxy not detected at $proxy"
|
# check using wget, if not, check with curl.
|
||||||
|
if command -v wget > /dev/null; then
|
||||||
|
if wget --quiet --execute "http_proxy=$proxy" --spider "proxy.intra.qt.io"; then
|
||||||
|
echo "Setting http_proxy to $proxy"
|
||||||
|
export http_proxy=$proxy
|
||||||
|
else
|
||||||
|
echo "Proxy not detected at $proxy"
|
||||||
|
fi
|
||||||
|
elif command -v curl > /dev/null; then
|
||||||
|
if curl --silent --proxy "$proxy" --head "proxy.intra.qt.io"; then
|
||||||
|
echo "Setting http_proxy to $proxy"
|
||||||
|
export http_proxy=$proxy
|
||||||
|
else
|
||||||
|
echo "Proxy not detected at $proxy"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Error: Neither 'wget' or 'curl' is installed. Cannot attempt to setup proxy."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user