6363DOWNLOAD_COMMAND=" "
6464DOWNLOAD_OUTPUT=" "
6565DOWNLOAD_SILENT=" "
66+ DOWNLOAD_REDIRECT=" "
6667
6768if command -v wget > /dev/null; then
6869 DOWNLOAD_COMMAND=" wget"
6970 DOWNLOAD_OUTPUT=" -O"
7071 DOWNLOAD_SILENT=" -q"
72+ DOWNLOAD_REDIRECT=" "
7173elif command -v curl > /dev/null; then
7274 DOWNLOAD_COMMAND=" curl"
7375 DOWNLOAD_OUTPUT=" -o"
7476 DOWNLOAD_SILENT=" -s"
77+ DOWNLOAD_REDIRECT=" -L"
7578else
7679 echo " Error: Unable to find 'wget' or 'curl' command."
7780 exit 1
@@ -190,7 +193,7 @@ download_version() {
190193
191194 if [ -n " $versionToDownload " ]; then
192195 if [ " $versionToDownload " = " LATEST" ]; then
193- latest_release=` $DOWNLOAD_COMMAND $DOWNLOAD_SILENT ${DOWNLOAD_OUTPUT} - https://api.github.com/repos/gohugoio/hugo/releases/latest`
196+ latest_release=` $DOWNLOAD_COMMAND $DOWNLOAD_SILENT $DOWNLOAD_REDIRECT $ {DOWNLOAD_OUTPUT} - https://api.github.com/repos/gohugoio/hugo/releases/latest`
194197 versionToDownload=` parse_json " $latest_release " " tag_name" `
195198 fi
196199
@@ -208,8 +211,8 @@ download_version() {
208211 local checksumName=" checksum.txt"
209212 local checksumPath=" $BASE_DIR /.hugo/${checksumName} "
210213
211- $DOWNLOAD_COMMAND $DOWNLOAD_SILENT $DOWNLOAD_OUTPUT " $tarballPath " " $binaryUrl " &
212- $DOWNLOAD_COMMAND $DOWNLOAD_SILENT $DOWNLOAD_OUTPUT " $checksumPath " " $checksumUrl " &
214+ $DOWNLOAD_COMMAND $DOWNLOAD_SILENT $DOWNLOAD_REDIRECT $ DOWNLOAD_OUTPUT " $tarballPath " " $binaryUrl " &
215+ $DOWNLOAD_COMMAND $DOWNLOAD_SILENT $DOWNLOAD_REDIRECT $ DOWNLOAD_OUTPUT " $checksumPath " " $checksumUrl " &
213216 wait
214217
215218 if [ -s " $tarballPath " -a -s " $checksumPath " ]; then
@@ -256,7 +259,7 @@ download_version() {
256259# ----------------------------------------------------------------------------
257260if [ " $upgrade " = true ]; then
258261 printf " downloading hugow binary ... "
259- $DOWNLOAD_COMMAND $DOWNLOAD_SILENT $DOWNLOAD_OUTPUT " hugow" " https://raw.githubusercontent.com/khos2ow/hugo-wrapper/master/hugow" &
262+ $DOWNLOAD_COMMAND $DOWNLOAD_SILENT $DOWNLOAD_REDIRECT $ DOWNLOAD_OUTPUT " hugow" " https://raw.githubusercontent.com/khos2ow/hugo-wrapper/master/hugow" &
260263 wait
261264 printf " [done]\n"
262265 chmod +x hugow
@@ -278,7 +281,7 @@ if [ -r "$BASE_DIR/.hugo/hugo" ]; then
278281 echo " hugo binary version $get_version already exists"
279282 fi
280283 elif [ $get_latest = true ]; then
281- latest_release=` $DOWNLOAD_COMMAND $DOWNLOAD_SILENT ${DOWNLOAD_OUTPUT} - https://api.github.com/repos/gohugoio/hugo/releases/latest`
284+ latest_release=` $DOWNLOAD_COMMAND $DOWNLOAD_SILENT $DOWNLOAD_REDIRECT $ {DOWNLOAD_OUTPUT} - https://api.github.com/repos/gohugoio/hugo/releases/latest`
282285 latest_version=` parse_json " $latest_release " " tag_name" | sed -ne ' s/[^0-9]*\(\([0-9]*\.\)\{0,4\}[0-9]*[^.]\).*/\1/p' `
283286
284287 if [ " $latest_version " != " $current_binary_version " ]; then
0 commit comments