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