DRY up some install scripts
parent
8e73c4c778
commit
78eb8854bf
@ -1,30 +1,20 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -e
|
|
||||||
set -x
|
|
||||||
|
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
|
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
|
||||||
|
|
||||||
APP=hugo
|
get_arch () {
|
||||||
VERSION=${VERSION:-0.81.0}
|
case $(uname -m) in
|
||||||
APPS_DIR=${XDG_DATA_HOME}/buddy-up/apps/${APP}
|
x86_64*) echo 64bit;;
|
||||||
|
*) >&2 echo "unsupported architecture: $(uname -m)"; exit 1;;
|
||||||
ARCH=
|
esac
|
||||||
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}"
|
APP=hugo
|
||||||
set_current_link "${APPS_DIR}" "${VERSION}"
|
VERSION=${VERSION:-0.85.0}
|
||||||
|
DEST="${XDG_DATA_HOME}/apps/releases/${APP}"
|
||||||
|
URL=https://github.com/gohugoio/hugo/releases/download/v${VERSION}/hugo_extended_${VERSION}_$(uname)-$(get_arch).tar.gz
|
||||||
|
|
||||||
apps=$(find "${APPS_DIR}/current/" -maxdepth 1 -executable -type f -exec basename {} \;)
|
extract_tarball "${URL}" "${DEST}/${VERSION}"
|
||||||
cd "${XDG_BIN_HOME}"
|
set_current_link "${DEST}" "${VERSION}"
|
||||||
for bin in $apps; do
|
set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}"
|
||||||
if [[ ! -s $bin ]]; then
|
|
||||||
ln --symbolic \
|
|
||||||
"$(relative_path "${XDG_BIN_HOME}" "${APPS_DIR}/current/${bin}")" \
|
|
||||||
"${bin}"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
Loading…
Reference in New Issue