You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
932 B
Plaintext
35 lines
932 B
Plaintext
4 years ago
|
#!/usr/bin/env bash
|
||
|
|
||
|
set -x
|
||
|
set -e
|
||
|
|
||
|
VERSION=${VERSION:-0.79.0}
|
||
|
|
||
|
LOCAL="${LOCAL:-${XDG_DATA_HOME:-${HOME}/.local}}"
|
||
|
SHARE_DIR="${LOCAL}/share/buddy-up"
|
||
|
DATA_DIR="${SHARE_DIR}/apps"
|
||
|
BIN_DIR="${BIN_DIR:-${XDG_BIN_HOME:-${LOCAL}/bin}}"
|
||
|
|
||
|
TMP_DIR=
|
||
|
if [[ ! -f "${DATA_DIR}/hugo/${VERSION}/hugo" ]] ; then
|
||
|
URL=https://github.com/gohugoio/hugo/releases/download/v${VERSION}/hugo_${VERSION}_$(uname -s)-64bit.tar.gz
|
||
|
TMP_DIR=$(mktemp --directory)
|
||
|
cd "${TMP_DIR}"
|
||
|
curl --location --silent --output release.tar.gz "${URL}"
|
||
|
tar xvzf release.tar.gz
|
||
|
mkdir -p "${DATA_DIR}/hugo/${VERSION}"
|
||
|
mv ./hugo "${DATA_DIR}/hugo/${VERSION}/hugo"
|
||
|
fi
|
||
|
|
||
|
cd "${DATA_DIR}/hugo/"
|
||
|
[[ -s current ]] && unlink current
|
||
|
ln -s "${VERSION}" current
|
||
|
|
||
|
cd "${BIN_DIR}"
|
||
|
[[ -L "hugo" ]] || ln --symbolic "${DATA_DIR}/hugo/current/hugo" hugo
|
||
|
|
||
|
if [[ "${TMP_DIR}" != "" ]]; then
|
||
|
rm -rf "${TMP_DIR}"
|
||
|
echo removed up temp directory "${TMP_DIR}"
|
||
|
fi
|