From 19e8a408b49ae626614d600f59595b5f34996001 Mon Sep 17 00:00:00 2001 From: Buddy Sandidge Date: Fri, 18 Mar 2022 11:08:53 -0700 Subject: [PATCH] Add install script for tile38 --- install-scripts/.local/bin/install-tile38 | 38 +++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 install-scripts/.local/bin/install-tile38 diff --git a/install-scripts/.local/bin/install-tile38 b/install-scripts/.local/bin/install-tile38 new file mode 100755 index 0000000..f4714c7 --- /dev/null +++ b/install-scripts/.local/bin/install-tile38 @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" + +APP=tile38 +VERSION=${VERSION:-1.27.1} +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