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