1
0

add install-atuin

This commit is contained in:
2024-01-20 14:39:20 +01:00
parent 4b24ccf4c3
commit 431247ce30

View File

@@ -0,0 +1,37 @@
#!/bin/bash
set -eu
source "${BOOTSTRAP_LIB}/helpers"
VERSION="17.2.1"
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-v${VERSION}-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-v${VERSION}-x86_64-unknown-linux-gnu/atuin"
echo "Removing ${TARGET}..."
rm -f "${TARGET}"