Merge pull request #67 from rstudio/jc-ua
Pass through custom user-agent if specified
This commit is contained in:
commit
516e791a93
1 changed files with 14 additions and 4 deletions
18
install.sh
18
install.sh
|
|
@ -338,19 +338,29 @@ do_download () {
|
||||||
|
|
||||||
if [[ -z "${wget_rc}" ]]; then
|
if [[ -z "${wget_rc}" ]]; then
|
||||||
echo "Downloading ${url}..."
|
echo "Downloading ${url}..."
|
||||||
|
local header
|
||||||
|
if [[ -n "${RS_USER_AGENT}" ]]; then
|
||||||
|
header="--header 'User-Agent: ${RS_USER_AGENT}'"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "${RUN_UNATTENDED}" -ne "0" ]]; then
|
if [[ "${RUN_UNATTENDED}" -ne "0" ]]; then
|
||||||
wget -q "${url}"
|
wget -q "${header}" "${url}"
|
||||||
else
|
else
|
||||||
wget --progress=bar "${url}"
|
wget --progress=bar "${header}" "${url}"
|
||||||
fi
|
fi
|
||||||
rc=$?
|
rc=$?
|
||||||
# Or, If curl is around, use that.
|
# Or, If curl is around, use that.
|
||||||
elif [[ -z "${curl_rc}" ]]; then
|
elif [[ -z "${curl_rc}" ]]; then
|
||||||
echo "Downloading ${url}..."
|
echo "Downloading ${url}..."
|
||||||
|
local header
|
||||||
|
if [[ -n "${RS_USER_AGENT}" ]]; then
|
||||||
|
header="-H 'User-Agent: ${RS_USER_AGENT}'"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "${RUN_UNATTENDED}" -ne "0" ]]; then
|
if [[ "${RUN_UNATTENDED}" -ne "0" ]]; then
|
||||||
curl -fsSL --output "${file_name}" "${url}"
|
curl -fsSL "${header}" --output "${file_name}" "${url}"
|
||||||
else
|
else
|
||||||
curl -fL --output "${file_name}" --progress-bar "${url}"
|
curl -fL "${header}" --output "${file_name}" --progress-bar "${url}"
|
||||||
fi
|
fi
|
||||||
rc=$?
|
rc=$?
|
||||||
# Otherwise, we can't go on.
|
# Otherwise, we can't go on.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue