From e8252b1a1a55fa659e2093e17529630cbc322eea Mon Sep 17 00:00:00 2001 From: Karsten Hachmeister Date: Fri, 15 Jul 2022 23:20:05 +0200 Subject: [PATCH] add starship install script --- .config/yadm/bootstrap.d/install-starship | 33 +++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 .config/yadm/bootstrap.d/install-starship diff --git a/.config/yadm/bootstrap.d/install-starship b/.config/yadm/bootstrap.d/install-starship new file mode 100755 index 0000000..e231e15 --- /dev/null +++ b/.config/yadm/bootstrap.d/install-starship @@ -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"