From: Jonathan Wakely Date: Fri, 5 Jun 2026 14:54:44 +0000 (+0100) Subject: contrib: Use 'command -v' in download_prerequisites X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2ffe26f6fc17c279c017ffc215f03288ded7884e;p=thirdparty%2Fgcc.git contrib: Use 'command -v' in download_prerequisites If wget is not installed, this script prints a message to standard error which makes it looks like something is wrong: ./contrib/download_prerequisites: line 53: type: wget: not found But if curl is installed then the script works fine. The command should also redirect stderr with 2>&1 but it seems preferable to just replace the use of 'type' with 'command -v' which is silent when the command is not found. Also add an explicit check for curl and print a more helpful error if not found. contrib/ChangeLog: * download_prerequisites: use 'command -v' to check for wget and curl. --- diff --git a/contrib/download_prerequisites b/contrib/download_prerequisites index de3c8f0582d..9e4bed94bed 100755 --- a/contrib/download_prerequisites +++ b/contrib/download_prerequisites @@ -50,10 +50,17 @@ force=0 only_gettext=false OS=$(uname) -if type wget > /dev/null ; then +die() { + echo "error: $@" >&2 + exit 1 +} + +if command -v wget > /dev/null ; then fetch='wget' -else +elif command -v curl > /dev/null ; then fetch='curl -LO' +else + die "Install wget or curl" fi chksum_extension='sha512' directory='.' @@ -86,11 +93,6 @@ Copyright (C) 2016-2026 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." -die() { - echo "error: $@" >&2 - exit 1 -} - for arg in "$@" do case "${arg}" in