2020-04-06 05:15:52 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-10-05 18:24:35 +02:00
|
|
|
PATH=~/.local/bin:$PATH
|
|
|
|
|
2020-04-06 05:15:52 +02:00
|
|
|
if [ -z $1 ]; then
|
|
|
|
echo "[x] HUGO_VERSION is not set, pass it as \$1"
|
|
|
|
exit 9001
|
|
|
|
else
|
|
|
|
HUGO_VERSION=$1
|
|
|
|
fi
|
|
|
|
|
2020-10-05 18:24:35 +02:00
|
|
|
if [ $(hugo version | grep -q ${HUGO_VERSION}; echo $?) -eq 0 ]; then
|
|
|
|
echo "[*] which hugo: $(which hugo)"
|
|
|
|
echo "[*] already on $HUGO_VERSION, exiting..."
|
|
|
|
exit 0
|
|
|
|
fi
|
2020-04-06 05:15:52 +02:00
|
|
|
|
2020-05-20 12:45:23 +02:00
|
|
|
nutmp=$(mktemp -d);cd "$nutmp";unset nutmp
|
2020-04-06 05:15:52 +02:00
|
|
|
|
|
|
|
WORKDIR=$(pwd)
|
|
|
|
HOMEBIN="/home/$USER/.local/bin"
|
|
|
|
mkdir -pv $HOMEBIN
|
|
|
|
|
|
|
|
echo "[*] downloading hugo version \"$HUGO_VERSION\""
|
2020-05-20 12:46:42 +02:00
|
|
|
curl -sL https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz | bsdtar xfv -
|
2020-04-06 05:15:52 +02:00
|
|
|
mv -vf hugo ${HOMEBIN}
|
|
|
|
|
|
|
|
cd ..
|
|
|
|
rm -rfv $WORKDIR
|
|
|
|
echo "[*] hugo updated to version $HUGO_VERSION"
|