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.

39 lines
1.3 KiB
Bash

#!/usr/bin/env bash
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
APP=tile38
VERSION=${VERSION:-1.30.2}
DEST=${XDG_DATA_HOME}/apps/releases/${APP}
install_zip () (
URL=https://github.com/tidwall/tile38/releases/download/${VERSION}/tile38-${VERSION}-$(get_os)-$(get_arch).zip
extract_zip "${URL}" "${DEST}/${VERSION}"
set_current_link "${DEST}" "${VERSION}"
DEST_DIR=${DEST}/${VERSION}/tile38-${VERSION}-$(get_os)-$(get_arch)
pushd "${DEST_DIR}" || exit 1
mv -v ./* ../
popd || exit 1
rmdir "${DEST_DIR}"
set_link "${XDG_BIN_HOME}/tile38-benchmark" "${DEST}" tile38-benchmark
set_link "${XDG_BIN_HOME}/tile38-cli" "${DEST}" tile38-cli
set_link "${XDG_BIN_HOME}/tile38-server" "${DEST}" tile38-server
)
install_targz () (
URL=https://github.com/tidwall/tile38/releases/download/${VERSION}/tile38-${VERSION}-$(get_os)-$(get_arch).tar.gz
extract_tarball "${URL}" "${DEST}/${VERSION}" "--strip-component 1"
set_current_link "${DEST}" "${VERSION}"
set_link "${XDG_BIN_HOME}/tile38-benchmark" "${DEST}" tile38-benchmark
set_link "${XDG_BIN_HOME}/tile38-cli" "${DEST}" tile38-cli
set_link "${XDG_BIN_HOME}/tile38-server" "${DEST}" tile38-server
)
case $(get_os) in
darwin) install_zip;;
freebsd) install_zip;;
windows) install_zip;;
linux) install_targz;;
*) >&2 echo "unsupported os $(uname -s)"; exit 1;;
esac