Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: shell compatibility in install script #1009

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,21 @@ mv "$BINARY_NAME" "$INSTALL_DIR/$BINARY_NAME"
rm "$TARBALL_NAME"

# Add $HOME/.local/bin to PATH if not already present
if ! echo "$PATH" | grep -q "$HOME/.local/bin"; then
echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$HOME/.bashrc"
echo "Added $HOME/.local/bin to PATH. Reload your shell or run: source ~/.bashrc"
if ! echo "$PATH" | grep -q "$INSTALL_DIR"; then
SHELL_CONFIG_FILE="$HOME/.bashrc"
case "$SHELL" in
*/zsh) SHELL_CONFIG_FILE="$HOME/.zshrc" ;;
*/fish) SHELL_CONFIG_FILE="$HOME/.config/fish/config.fish" ;;
*/csh|*/tcsh) SHELL_CONFIG_FILE="$HOME/.cshrc" ;;
esac

echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$SHELL_CONFIG_FILE"
echo "Added $HOME/.local/bin to PATH in $SHELL_CONFIG_FILE. Please reload your shell or run: source $SHELL_CONFIG_FILE"
fi

echo "$BINARY_NAME installed successfully in $INSTALL_DIR. Run '$BINARY_NAME --version' to verify."
# Final message
echo "$BINARY_NAME installed successfully in $INSTALL_DIR."
echo "To verify the installation, make sure $INSTALL_DIR is in your PATH."
echo "Run the following command to update your current shell session if needed:"
echo "source <your-shell-config-file>"
echo "Then run '$BINARY_NAME --version' to confirm the installation."
Loading