Skip to content

Commit 75a71a7

Browse files
committed
install-hugo: support running on Windows, too
This requires Git Bash; The tell-tale is the environment variable `MSYSTEM`, which is set to `MINGW64` for amd64 CPUs. The script will install `hugo.exe` into `~/bin`, which is prepended to the `PATH` in Git Bash by default. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 3d95949 commit 75a71a7

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

script/install-hugo.sh

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,28 @@ die() {
55
exit 1
66
}
77

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+
823
HUGO_VERSION=$(sed -n 's/^ *hugo_version: *//p' <hugo.yml) &&
924
test -n "$HUGO_VERSION" ||
1025
die "hugo_version not found in hugo.yml"
1126

1227
echo "Upgrading to Hugo v${HUGO_VERSION}" >&2
1328

1429
download_url=https://github.com/gohugoio/hugo/releases/download &&
15-
curl -Lo /tmp/hugo.deb $download_url/v$HUGO_VERSION/hugo_extended_${HUGO_VERSION}_linux-amd64.deb &&
16-
sudo dpkg -i /tmp/hugo.deb ||
17-
die "Failed to install Hugo version $HUGO_VERSION"
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"

0 commit comments

Comments
 (0)