summaryrefslogtreecommitdiffstats
path: root/packaging/installer/functions.sh
diff options
context:
space:
mode:
Diffstat (limited to 'packaging/installer/functions.sh')
-rw-r--r--packaging/installer/functions.sh26
1 files changed, 24 insertions, 2 deletions
diff --git a/packaging/installer/functions.sh b/packaging/installer/functions.sh
index af8e08022a..822019c791 100644
--- a/packaging/installer/functions.sh
+++ b/packaging/installer/functions.sh
@@ -95,7 +95,7 @@ progress() {
get() {
url="${1}"
if command -v curl > /dev/null 2>&1; then
- curl -sSL -o - --connect-timeout 10 --retry 3 "${url}"
+ curl -q -o - -sSL --connect-timeout 10 --retry 3 "${url}"
elif command -v wget > /dev/null 2>&1; then
wget -T 15 -O - "${url}"
else
@@ -103,6 +103,28 @@ get() {
fi
}
+download_file() {
+ url="${1}"
+ dest="${2}"
+ name="${3}"
+ opt="${4}"
+
+ if command -v curl > /dev/null 2>&1; then
+ run curl -q -sSL --connect-timeout 10 --retry 3 --output "${dest}" "${url}"
+ elif command -v wget > /dev/null 2>&1; then
+ run wget -T 15 -O "${dest}" "${url}"
+ else
+ echo >&2
+ echo >&2 "Downloading ${name} from '${url}' failed because of missing mandatory packages."
+ if [ -n "$opt" ]; then
+ echo >&2 "Either add packages or disable it by issuing '--disable-${opt}' in the installer"
+ fi
+ echo >&2
+
+ run_failed "I need curl or wget to proceed, but neither is available on this system."
+ fi
+}
+
# -----------------------------------------------------------------------------
# external component handling
@@ -114,7 +136,7 @@ fetch_and_verify() {
local override=${5}
if [ -z "${override}" ]; then
- get "${url}" > "${tmp}/${base_name}"
+ download_file "${url}" "${tmp}/${base_name}" "${component}"
else
progress "Using provided ${component} archive ${override}"
run cp "${override}" "${tmp}/${base_name}"