From 29fe7263f76009483a4773d0587cb01f57d49088 Mon Sep 17 00:00:00 2001 From: haixuanTao Date: Tue, 17 Sep 2024 14:07:33 +0200 Subject: [PATCH] Removed user input as it does not work within bash --- install.sh | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/install.sh b/install.sh index 92444376..242c744c 100755 --- a/install.sh +++ b/install.sh @@ -185,7 +185,9 @@ fi echo "Placing dora-rs cli in $dest" if [ -e "$dest/$bin" ] && [ "$force" = false ]; then - echo "\`$dest/$bin\` already exists" + echo " Replacing \`$dest/$bin\` with downloaded version" + cp "$td/$bin" "$dest/$bin" + chmod 755 "$dest/$bin" else mkdir -p "$dest" cp "$td/$bin" "$dest/$bin" @@ -197,31 +199,28 @@ read -p "Do you want to add $dest to your PATH automatically? (y/n): " response if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then if [ "$SHELL" = "/bin/bash" ]; then - if ! grep -q "$dest" ~/.bashrc; then - echo "Adding $dest to PATH in ~/.bashrc" - echo "export PATH=\$PATH:$dest" >> ~/.bashrc - source ~/.bashrc - echo "Path added to ~/.bashrc and reloaded." - else - echo "$dest is already in the PATH in ~/.bashrc" - fi - elif [ "$SHELL" = "/bin/zsh" ]; then - if ! grep -q "$dest" ~/.zshrc; then - echo "Adding $dest to PATH in ~/.zshrc" - echo "export PATH=\$PATH:$dest" >> ~/.zshrc - source ~/.zshrc - echo "Path added to ~/.zshrc and reloaded." - else - echo "$dest is already in the PATH in ~/.zshrc" - fi + if ! grep -q "$dest" ~/.bashrc; then + echo "Adding $dest to PATH in ~/.bashrc" + echo "export PATH=\$PATH:$dest" >> ~/.bashrc + source ~/.bashrc + echo "Path added to ~/.bashrc and reloaded." else - echo "Unsupported shell: $SHELL" - echo "Please add the following to your shell's configuration file manually:" - echo " export PATH=\$PATH:$dest" + echo "$dest is already in the PATH in ~/.bashrc" + fi +elif [ "$SHELL" = "/bin/zsh" ]; then + if ! grep -q "$dest" ~/.zshrc; then + echo "Adding $dest to PATH in ~/.zshrc" + echo "export PATH=\$PATH:$dest" >> ~/.zshrc + source ~/.zshrc + echo "Path added to ~/.zshrc and reloaded." + else + echo "$dest is already in the PATH in ~/.zshrc" fi else - echo "You chose not to add $dest to your PATH." - echo "To run dora CLI without adding to PATH, use: '~/.dora/bin/dora'" + echo "Unsupported shell: $SHELL" + echo "Please add the following to your shell's configuration file manually:" + echo " export PATH=\$PATH:$dest" fi + rm -rf "$td"