From 22c0ff21e4fff52fb92ca4e4b27c7e3818ba263a Mon Sep 17 00:00:00 2001 From: Matt Godbolt Date: Fri, 24 Nov 2023 19:00:48 -0600 Subject: [PATCH] Update install.sh --- conf/install.sh | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/conf/install.sh b/conf/install.sh index a8d3a24..80a86bd 100644 --- a/conf/install.sh +++ b/conf/install.sh @@ -6,15 +6,26 @@ set -euo pipefail echo Installing ozy pointing at the ozy sample team configuration on GitHub... OZY_CONFIG_URL=https://raw.githubusercontent.com/aquanauts/ozy/main/conf/sample-team-conf.yaml -OZY_OS=linux -if [[ "$(uname)" == "Darwin" ]]; then OZY_OS=osx; fi -OZY_VERSION=$(curl -sL ${OZY_CONFIG_URL} | grep 'ozy_version:' | awk '{print $2}') +OZY_OS=$(uname) +OZY_ARCH=$(uname -p) -TMP_INSTALL_FILE="$(mktemp)" -curl -sL -o "${TMP_INSTALL_FILE}" https://github.com/aquanauts/ozy/releases/download/v${OZY_VERSION}/ozy-${OZY_OS} +if [ -n "${OZY_VERSION:-}" ]; then + echo "Using ${OZY_VERSION} as it was set in the environment" +else + echo "Reading config information from ${OZY_CONFIG_URL}" + OZY_VERSION=$(curl --fail -sSL ${OZY_CONFIG_URL} | grep 'ozy_version:' | awk '{print $2}') + echo "Found ozy version ${OZY_VERSION}" +fi + +echo Installing ozy v${OZY_VERSION} for ${OZY_OS}-${OZY_ARCH} + +TMP_INSTALL_DIR=${HOME}/.tmp-ozy-install-$$ # on same path as HOME because of issue #73 +mkdir -p "${TMP_INSTALL_DIR}" +TMP_INSTALL_FILE=${TMP_INSTALL_DIR}/ozy # ozy needs to be called "ozy" to work +curl -sL -o "${TMP_INSTALL_FILE}" https://github.com/aquanauts/ozy/releases/download/v${OZY_VERSION}/ozy-${OZY_OS}-${OZY_ARCH} chmod +x "${TMP_INSTALL_FILE}" ${TMP_INSTALL_FILE} init ${OZY_CONFIG_URL} -rm -f "${TMP_INSTALL_FILE}" +rm -rf "${TMP_INSTALL_DIR}" echo echo '********************************'