From 7b939159ee1c679ba00375cc424347d0054ceb9e Mon Sep 17 00:00:00 2001 From: mik-tf Date: Sun, 19 Jan 2025 19:10:53 -0500 Subject: [PATCH] update install script for shell source --- install.sh | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 0e11bcb..ae174ba 100755 --- a/install.sh +++ b/install.sh @@ -1,4 +1,3 @@ - #!/bin/bash set -ex @@ -8,13 +7,33 @@ cd "${script_dir}" echo "Docs directory: $script_dir" -#Check if bun is installed +# Function to detect the current shell and source the appropriate rc file +source_rc_file() { + local shell_name=$(basename "$SHELL") + case "$shell_name" in + bash) + source "$HOME/.bashrc" + ;; + zsh) + source "$HOME/.zshrc" + ;; + fish) + source "$HOME/.config/fish/config.fish" + ;; + *) + echo "Unsupported shell: $shell_name" + exit 1 + ;; + esac +} + +# Check if bun is installed if ! command -v bun &> /dev/null; then echo "Bun is not installed. Installing..." curl -fsSL https://bun.sh/install | bash + source_rc_file else echo "Bun is already installed." fi -bun install - +bun install \ No newline at end of file