From b763a84637c665a16ad3cf76987cb6cf8b0d50a0 Mon Sep 17 00:00:00 2001 From: Ian McLerran Date: Tue, 4 Jun 2024 18:28:10 -0500 Subject: [PATCH] improvements to install script --- src/install | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/install b/src/install index 7f64c97..a946f73 100755 --- a/src/install +++ b/src/install @@ -6,14 +6,26 @@ MAGENTA="\033[35m" CYAN="\033[36m" RESET="\033[0m" +# Check if $LOCAL_BIN exists and create it if it does not +[ ! -d "$LOCAL_BIN" ] && mkdir -p "$LOCAL_BIN" + +# Notify user that roc-start build process is starting echo -e "Building ${MAGENTA}roc-start${RESET}...\n" roc build --output roc-start --optimize > /dev/null 2>&1 + +# If build succeeds, copy the executable to $LOCAL_BIN and notify user if [ $? -eq 0 ]; then cp ./roc-start $LOCAL_BIN echo -e "${MAGENTA}roc-start${RESET} installed to $LOCAL_BIN" fi +# Check if the GitHub CLI (gh) is installed if ! command -v gh > /dev/null 2>&1; then echo -e "${YELLOW}- NOTE: ${MAGENTA}roc-start${RESET} requires ${CYAN}gh${RESET} to be installed. Please install the GitHub CLI: https://cli.github.com" exit 1 -fi \ No newline at end of file +fi + +# Check if $LOCAL_BIN is in the PATH +if [[ ":$PATH:" != *":$LOCAL_BIN:"* ]]; then + echo -e "${YELLOW}- NOTE:${RESET} $LOCAL_BIN is not in your PATH. Please make sure to add it to your shell's configuration file (e.g. ~/.zshrc, ~/.bashrc, etc.)" +fi