#!/usr/bin/env bash set -e set -x # shellcheck disable=SC1090 source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=hugo VERSION=${VERSION:-0.81.0} APPS_DIR=${XDG_DATA_HOME}/buddy-up/apps/${APP} ARCH= case $(get_arch) in amd64) ARCH=64bit esac URL=https://github.com/gohugoio/hugo/releases/download/v${VERSION}/hugo_${VERSION}_$(uname)-${ARCH}.tar.gz extract_tarball "${URL}" "${APPS_DIR}/${VERSION}" set_current_link "${APPS_DIR}" "${VERSION}" apps=$(find "${APPS_DIR}/current/" -maxdepth 1 -executable -type f -exec basename {} \;) cd "${XDG_BIN_HOME}" for bin in $apps; do if [[ ! -s $bin ]]; then ln --symbolic \ "$(relative_path "${XDG_BIN_HOME}" "${APPS_DIR}/current/${bin}")" \ "${bin}" fi done