Skip to content

Instantly share code, notes, and snippets.

@JakobMiksch
Created July 27, 2024 13:35
Show Gist options
  • Select an option

  • Save JakobMiksch/8f58b440f8d861c4aa085781a0b21d20 to your computer and use it in GitHub Desktop.

Select an option

Save JakobMiksch/8f58b440f8d861c4aa085781a0b21d20 to your computer and use it in GitHub Desktop.
Hugo Go Download Script
#!/bin/bash
set -e
HUGO_VERSION=$1
TMP_DOWNLOAD_FILE="hugo_${HUGO_VERSION}_Linux-64bit.tar.gz"
URL="https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/${TMP_DOWNLOAD_FILE}"
HUGO_EXECUTABLE="hugo"
HUGO_EXECUTABLE_EXPORT_NAME="hugo_${HUGO_VERSION}"
echo "starting download ..."
# Download the release asset
wget -O ${TMP_DOWNLOAD_FILE} ${URL}
echo "download finished ..."
# Extract the hugo executable
tar -xzvf ${TMP_DOWNLOAD_FILE} ${HUGO_EXECUTABLE}
rm -rf ${TMP_DOWNLOAD_FILE}
chmod +x ${HUGO_EXECUTABLE}
mv ${HUGO_EXECUTABLE} ${HUGO_EXECUTABLE_EXPORT_NAME}
echo "successfully downloaded hugo executable: ${HUGO_EXECUTABLE_EXPORT_NAME}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment