add install-atuin
This commit is contained in:
37
.config/yadm/bootstrap.d/install-atuin
Executable file
37
.config/yadm/bootstrap.d/install-atuin
Executable 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}"
|
||||
Reference in New Issue
Block a user