From 2f61999519e27f91a2b4e918b204ba4761869bbe Mon Sep 17 00:00:00 2001 From: Jonathan Curran Date: Tue, 9 Jun 2020 09:33:43 -0600 Subject: [PATCH 1/3] Pass through user-agent if specified --- install.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 5eae1bb..5ed76a6 100755 --- a/install.sh +++ b/install.sh @@ -338,19 +338,28 @@ do_download () { if [[ -z "${wget_rc}" ]]; then echo "Downloading ${url}..." + local header + if [[ -n "${RS_USER_AGENT}" ]]; then + header="-d --header 'User-Agent: ${RS_USER_AGENT}'" + fi + if [[ "${RUN_UNATTENDED}" -ne "0" ]]; then - wget -q "${url}" + wget -q "${header}" "${url}" else - wget --progress=bar "${url}" + wget --progress=bar "${header}" "${url}" fi rc=$? # Or, If curl is around, use that. elif [[ -z "${curl_rc}" ]]; then echo "Downloading ${url}..." + if [[ -n "${RS_USER_AGENT}" ]]; then + header="-H 'User-Agent: ${RS_USER_AGENT}'" + fi + if [[ "${RUN_UNATTENDED}" -ne "0" ]]; then - curl -fsSL --output "${file_name}" "${url}" + curl -fsSL "${header}" --output "${file_name}" "${url}" else - curl -fL --output "${file_name}" --progress-bar "${url}" + curl -fL "${header}" --output "${file_name}" --progress-bar "${url}" fi rc=$? # Otherwise, we can't go on. @@ -368,6 +377,7 @@ do_download () { exit ${rc} fi fi + exit } # This helps determine whether a given command exists or not. From 4ef319313cff39ba3e35a5663c3c0fdcf9d8497e Mon Sep 17 00:00:00 2001 From: Jonathan Curran Date: Tue, 9 Jun 2020 10:13:54 -0600 Subject: [PATCH 2/3] Remove debug flag --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 5ed76a6..27a2081 100755 --- a/install.sh +++ b/install.sh @@ -340,7 +340,7 @@ do_download () { echo "Downloading ${url}..." local header if [[ -n "${RS_USER_AGENT}" ]]; then - header="-d --header 'User-Agent: ${RS_USER_AGENT}'" + header="--header 'User-Agent: ${RS_USER_AGENT}'" fi if [[ "${RUN_UNATTENDED}" -ne "0" ]]; then From 44c45590bc97b48600793a2d211bea071c573f83 Mon Sep 17 00:00:00 2001 From: Jonathan Curran Date: Tue, 9 Jun 2020 10:18:22 -0600 Subject: [PATCH 3/3] Remove early exit --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 27a2081..d0cb02b 100755 --- a/install.sh +++ b/install.sh @@ -352,6 +352,7 @@ do_download () { # Or, If curl is around, use that. elif [[ -z "${curl_rc}" ]]; then echo "Downloading ${url}..." + local header if [[ -n "${RS_USER_AGENT}" ]]; then header="-H 'User-Agent: ${RS_USER_AGENT}'" fi @@ -377,7 +378,6 @@ do_download () { exit ${rc} fi fi - exit } # This helps determine whether a given command exists or not.