#!/bin/bash set -eu source "${BOOTSTRAP_LIB}/helpers" VERSION="18.3.0" INSTALL_DIR="${HOME}/.local/bin" INSTALLED_VERSION="" if [[ -x "$(command -v atuin)" ]]; then INSTALLED_VERSION="$(atuin --version | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+')" fi if [[ "$VERSION" == "$INSTALLED_VERSION" ]]; then echo "atuin version ${VERSION} already installed." exit 0 fi echo "Installing atuin version ${VERSION} ..." URL="https://github.com/atuinsh/atuin/releases/download/v${VERSION}/atuin-x86_64-unknown-linux-gnu.tar.gz" echo "Downloading from ${URL} ..." TARGET="$(download "$URL")" if [[ -f "${INSTALL_DIR}/atuin" ]]; then echo "Removing old atuin command..." rm -f "${INSTALL_DIR}/atuin" fi echo "Unpacking atuin command to ${INSTALL_DIR}..." mkdir -p "${INSTALL_DIR}" tar --directory="${INSTALL_DIR}" -xf "${TARGET}" --strip-components 1 "atuin-x86_64-unknown-linux-gnu/atuin" echo "Removing ${TARGET} ..." rm -f "${TARGET}"