Update Hugo
Published on May 3, 2019
| Comments
| Deutsche Version
Hugo is not installed on my webspace by default. Therefore I have to install new versions manually. To make this easier I built a small script.
#!/bin/bash
BIN_DIR=$HOME/bin
CUR_VERSION="$("$BIN_DIR"/hugo version 2>/dev/null | cut -d'v' -f2 | cut -c 1-6)"
NEW_VERSION=$(curl --silent "https://api.github.com/repos/gohugoio/hugo/tags" | jq -r '.[0].name' | tr -d v)
echo "Hugo: Current Version: $CUR_VERSION => New Version: $NEW_VERSION"
if ! [ "$NEW_VERSION" = "$CUR_VERSION" ]; then
curl -L --output hugo.tar.gz "https://github.com/gohugoio/hugo/releases/download/v${NEW_VERSION}/hugo_${NEW_VERSION}_Linux-64bit.tar.gz"
tar -C "${BIN_DIR}" -xvzf hugo.tar.gz hugo
rm hugo.tar.gz
else
echo "Die current Version of Hugo ist allready installed"
fi
This checks whether the current version offered on Github is more current than the one available on the web space. If so, the current version of Github will be downloaded and installed on the webspace.
These articles could also be interesting:
- Insert notices in articles under Hugo
- Hugo - Remove content from sitemap
- Some articles are now offered in multiple languages
- Insert date in Sublime Text
- Switched to Complete Feed
Hint
I reserve the right not to activate comments. The activation of comments can also take several days.