Skip to content

Commit caae021

Browse files
committed
Merge branch 'install-hugo-on-windows'
There is a script to install Hugo on Unix-like systems, with the improvable name `upgrade-hugo.sh`. This topic branch renames it, and also allows people like me who are not in the "I don't do Windows" camp to benefit from this script, too. It _does_ assume to be run in a Git Bash when run on Windows. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2 parents d7670a1 + 75a71a7 commit caae021

2 files changed

Lines changed: 32 additions & 17 deletions

File tree

script/install-hugo.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/sh
2+
3+
die() {
4+
echo "$*" >&2
5+
exit 1
6+
}
7+
8+
case "$MSYSTEM" in
9+
MINGW64)
10+
suffix=_windows-amd64.zip
11+
update() {
12+
unzip -d $HOME/bin /tmp/hugo$suffix hugo.exe
13+
}
14+
;;
15+
*)
16+
suffix=_linux-amd64.deb
17+
update() {
18+
sudo dpkg -i /tmp/hugo$suffix
19+
}
20+
;;
21+
esac
22+
23+
HUGO_VERSION=$(sed -n 's/^ *hugo_version: *//p' <hugo.yml) &&
24+
test -n "$HUGO_VERSION" ||
25+
die "hugo_version not found in hugo.yml"
26+
27+
echo "Upgrading to Hugo v${HUGO_VERSION}" >&2
28+
29+
download_url=https://github.com/gohugoio/hugo/releases/download &&
30+
curl -Lo /tmp/hugo$suffix $download_url/v$HUGO_VERSION/hugo_extended_${HUGO_VERSION}${suffix} &&
31+
update ||
32+
die "Failed to install Hugo version $HUGO_VERSION"

script/upgrade-hugo.sh

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)