add helix installation
This commit is contained in:
41
.config/yadm/bootstrap.d/install-helix
Executable file
41
.config/yadm/bootstrap.d/install-helix
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
APPS_DIR="${HOME}/apps"
|
||||
|
||||
VERSION="22.05"
|
||||
INSTALL_DIR="${APPS_DIR}/helix"
|
||||
INSTALLED_VERSION=""
|
||||
|
||||
if [[ -x "$(command -v hx)" ]] ; then
|
||||
INSTALLED_VERSION="$(hx --version | grep -o '[0-9]\+\.[0-9]\+')"
|
||||
fi
|
||||
|
||||
if [[ "$VERSION" != "$INSTALLED_VERSION" ]] ; then
|
||||
echo "Helix editor version ${VERSION} already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Installing helix editor version ${VERSION}..."
|
||||
|
||||
URL="https://github.com/helix-editor/helix/releases/download/${VERSION}/helix-${VERSION}-x86_64-linux.tar.xz"
|
||||
|
||||
echo "Downloading from ${URL}..."
|
||||
TARGET="$(download "$URL")"
|
||||
|
||||
if [[ -d "${INSTALL_DIR}" ]] ; then
|
||||
echo "Removing old helix editor installation..."
|
||||
rm -rf "${INSTALL_DIR}"
|
||||
fi
|
||||
|
||||
echo "Unpacking file ${TARGET}..."
|
||||
mkdir -p "${APPS_DIR}"
|
||||
tar --directory="${APPS_DIR}" -xf "${TARGET}"
|
||||
|
||||
echo "Moving unpacked directory to ${INSTALL_DIR}"
|
||||
mv "${APPS_DIR}/helix-${VERSION}-x86_64-linux" "${INSTALL_DIR}"
|
||||
|
||||
echo "Creating link to helix editor executable..."
|
||||
mkdir -p "${HOME}/.local/bin"
|
||||
ln -s --force "${INSTALL_DIR}/hx" "${HOME}/.local/bin/"
|
||||
Reference in New Issue
Block a user