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.
49 lines
1.4 KiB
Plaintext
49 lines
1.4 KiB
Plaintext
3 years ago
|
#!/usr/bin/env bash
|
||
|
|
||
2 years ago
|
set -euo pipefail
|
||
|
|
||
|
# shellcheck disable=SC1091
|
||
3 years ago
|
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
|
||
|
|
||
|
APP=tile38
|
||
2 years ago
|
VERSION=${VERSION:-1.31.0}
|
||
2 years ago
|
DEST=${XDG_DATA_HOME}/apps/releases/${APP}
|
||
3 years ago
|
|
||
2 years ago
|
main() (
|
||
|
case $(get_os) in
|
||
|
darwin) install_zip ;;
|
||
|
freebsd) install_zip ;;
|
||
|
windows) install_zip ;;
|
||
|
linux) install_targz ;;
|
||
|
*)
|
||
|
echo >&2 "unsupported os $(uname -s)"
|
||
|
exit 1
|
||
|
;;
|
||
|
esac
|
||
|
)
|
||
|
|
||
|
install_zip() (
|
||
3 years ago
|
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
|
||
2 years ago
|
rmdir "${DEST_DIR}"
|
||
3 years ago
|
set_link "${XDG_BIN_HOME}/tile38-benchmark" "${DEST}" tile38-benchmark
|
||
2 years ago
|
set_link "${XDG_BIN_HOME}/tile38-cli" "${DEST}" tile38-cli
|
||
|
set_link "${XDG_BIN_HOME}/tile38-server" "${DEST}" tile38-server
|
||
3 years ago
|
)
|
||
|
|
||
2 years ago
|
install_targz() (
|
||
3 years ago
|
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
|
||
2 years ago
|
set_link "${XDG_BIN_HOME}/tile38-cli" "${DEST}" tile38-cli
|
||
|
set_link "${XDG_BIN_HOME}/tile38-server" "${DEST}" tile38-server
|
||
3 years ago
|
)
|
||
|
|
||
2 years ago
|
main "${@}"
|