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.
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='.'
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