add glow install script
This commit is contained in:
38
.config/yadm/bootstrap.d/install-glow
Executable file
38
.config/yadm/bootstrap.d/install-glow
Executable file
@@ -0,0 +1,38 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
source "${BOOTSTRAP_LIB}/helpers"
|
||||||
|
|
||||||
|
VERSION="1.4.1"
|
||||||
|
INSTALL_DIR="${HOME}/.local/bin"
|
||||||
|
INSTALLED_VERSION=""
|
||||||
|
|
||||||
|
if [[ -x "$(command -v glow)" ]]; then
|
||||||
|
INSTALLED_VERSION="$(glow --version | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+')"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$VERSION" == "$INSTALLED_VERSION" ]]; then
|
||||||
|
echo "glow version ${VERSION} already installed."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Installing glow version ${VERSION}..."
|
||||||
|
|
||||||
|
URL="https://github.com/charmbracelet/glow/releases/download/v${VERSION}/glow_${VERSION}_linux_x86_64.tar.gz"
|
||||||
|
|
||||||
|
echo "Downloading from ${URL}..."
|
||||||
|
TARGET="$(download "$URL")"
|
||||||
|
|
||||||
|
if [[ -f "${INSTALL_DIR}/glow" ]]; then
|
||||||
|
echo "Removing old glow command..."
|
||||||
|
rm -f "${INSTALL_DIR}/glow"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Unpacking glow command to ${INSTALL_DIR}..."
|
||||||
|
mkdir -p "${INSTALL_DIR}"
|
||||||
|
tar --directory="${INSTALL_DIR}" -xf "${TARGET}" glow
|
||||||
|
chmod +x "${INSTALL_DIR}/glow"
|
||||||
|
|
||||||
|
echo "Removing ${TARGET}..."
|
||||||
|
rm -f "${TARGET}"
|
||||||
Reference in New Issue
Block a user