-
Notifications
You must be signed in to change notification settings - Fork 6
/
get-hugo.sh
61 lines (42 loc) · 1.22 KB
/
get-hugo.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
DIR=${PWD}
#Required to be SET. TODO: Test for this, and if version is not present load from present. Use something like https://zwbetz.com/script-to-install-latest-hugo-release-on-linux-and-mac/
HUGO_VERSION="0.58.0"
HUGO_TYPE=true
FILE=hugo_${HUGO_VERSION}
set -e
if [ -n $HUGO_VERSION ]; then
echo Installing $HUGO_VERSION
else
exit
fi
#
if [ $HUGO_TYPE != false ] || [ $HUGO_TYPE != "false" ]; then
echo WE ARE Using Hugo Extended
EXTENDED="extended_"
else
echo NOT Using Hugo Extended
EXTENDED=""
fi
echo Cleaning bin directory
if [ -d ${PWD}/bin ]; then
rm -rf ${PWD}/bin
fi
echo Make temp directory
mkdir -p ${PWD}/temp ${PWD}/bin
echo Move to temp directory
pushd ${PWD}/temp
echo Current Directory: ${PWD}
curl -L https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${EXTENDED}${HUGO_VERSION}_macOS-64bit.tar.gz -o ${FILE}.tar.gz
TARBALL=${FILE}.tar.gz
echo Extracting $TARBALL
tar --extract --file $TARBALL
# do we need sudo command for these?
chmod +x hugo
mv hugo $DIR/bin/${FILE}
# Clean up temp directory (popd) ?
rm -rf $DIR/temp
location="$(which $DIR/bin/${FILE})"
echo "Hugo binary location: $location"
version="$($DIR/bin/${FILE} version)"
echo $version