From ca799ab27fc95b91436a8a33cac405eeef067f4b Mon Sep 17 00:00:00 2001 From: Corbin Davenport Date: Tue, 26 Jan 2021 13:26:19 -0500 Subject: [PATCH 1/3] Improve shell detection, add WSL support for exit webpage --- install.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index 1acdd92..2cfc49c 100755 --- a/install.sh +++ b/install.sh @@ -61,14 +61,14 @@ _add_path() { echo "[ OK ] $DIR/ is already in PATH." else # Nexus Tools directory needs to be added to $PATH - if [[ $SHELL == *"bash"* ]]; then - echo 'export PATH=$PATH:'$DIR >> $HOME/.bashrc - source "$HOME/.bashrc" - echo "[ OK ] Bash shell detected, added $DIR/ to $HOME/.bashrc." - elif [[ $SHELL == *"zsh"* ]]; then + if [[ $ZSH_VERSION ]]; then echo 'export PATH=$PATH:'$DIR >> $HOME/.zshrc source "$HOME/.zshrc" echo "[ OK ] Z Shell detected, added $DIR/ to $HOME/.zshrc." + elif [[ $BASH_VERSION ]]; then + echo 'export PATH=$PATH:'$DIR >> $HOME/.bashrc + source "$HOME/.bashrc" + echo "[ OK ] Bash shell detected, added $DIR/ to $HOME/.bashrc." else echo "[WARN] Shell could not be detected, you will need to manually add $DIR to your PATH." fi @@ -103,7 +103,9 @@ _analytics() { # Function for opening completion webpage _open_webpage() { - if [ "$OS" = "Darwin" ]; then + if [ -d "/mnt/c/Windows" ]; then + /mnt/c/Windows/explorer.exe "https://corbin.io/nexus-tools-exit.html" &>/dev/null & + elif [ "$OS" = "Darwin" ]; then open "https://corbin.io/nexus-tools-exit.html" &>/dev/null & else xdg-open "https://corbin.io/nexus-tools-exit.html" &>/dev/null & From 125bfe22748702512d51b0ee6d355022abaa4f67 Mon Sep 17 00:00:00 2001 From: Corbin Davenport Date: Tue, 26 Jan 2021 15:04:10 -0500 Subject: [PATCH 2/3] Update shell detection again --- install.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index 2cfc49c..bedc97b 100755 --- a/install.sh +++ b/install.sh @@ -20,6 +20,7 @@ INIURL="https://raw.githubusercontent.com/apkudo/adbusbini/master/adb_usb.ini" OS=$(uname) ARCH=$(uname -m) BASEURL="https://github.com/corbindavenport/nexus-tools/raw/master" +CURRENT_SHELL=$(ps -p "$$" -o 'comm=') ANALYTICS=$1 # Function for copying udex.txt to proper location @@ -61,14 +62,14 @@ _add_path() { echo "[ OK ] $DIR/ is already in PATH." else # Nexus Tools directory needs to be added to $PATH - if [[ $ZSH_VERSION ]]; then - echo 'export PATH=$PATH:'$DIR >> $HOME/.zshrc - source "$HOME/.zshrc" - echo "[ OK ] Z Shell detected, added $DIR/ to $HOME/.zshrc." - elif [[ $BASH_VERSION ]]; then + if [[ $CURRENT_SHELL == *"bash"* ]]; then echo 'export PATH=$PATH:'$DIR >> $HOME/.bashrc source "$HOME/.bashrc" echo "[ OK ] Bash shell detected, added $DIR/ to $HOME/.bashrc." + elif [[ $CURRENT_SHELL == *"zsh"* ]]; then + echo 'export PATH=$PATH:'$DIR >> $HOME/.zshrc + source "$HOME/.zshrc" + echo "[ OK ] Z Shell detected, added $DIR/ to $HOME/.zshrc." else echo "[WARN] Shell could not be detected, you will need to manually add $DIR to your PATH." fi From c561cd024e1c2978ca3f7085690f21dbf74b7d25 Mon Sep 17 00:00:00 2001 From: Corbin Davenport Date: Tue, 26 Jan 2021 15:51:05 -0500 Subject: [PATCH 3/3] Bash scripts were a mistake --- install.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index bedc97b..72d00f7 100755 --- a/install.sh +++ b/install.sh @@ -20,7 +20,6 @@ INIURL="https://raw.githubusercontent.com/apkudo/adbusbini/master/adb_usb.ini" OS=$(uname) ARCH=$(uname -m) BASEURL="https://github.com/corbindavenport/nexus-tools/raw/master" -CURRENT_SHELL=$(ps -p "$$" -o 'comm=') ANALYTICS=$1 # Function for copying udex.txt to proper location @@ -62,14 +61,14 @@ _add_path() { echo "[ OK ] $DIR/ is already in PATH." else # Nexus Tools directory needs to be added to $PATH - if [[ $CURRENT_SHELL == *"bash"* ]]; then - echo 'export PATH=$PATH:'$DIR >> $HOME/.bashrc - source "$HOME/.bashrc" - echo "[ OK ] Bash shell detected, added $DIR/ to $HOME/.bashrc." - elif [[ $CURRENT_SHELL == *"zsh"* ]]; then + if [[ "$SHELL" =~ "zsh" ]]; then echo 'export PATH=$PATH:'$DIR >> $HOME/.zshrc source "$HOME/.zshrc" echo "[ OK ] Z Shell detected, added $DIR/ to $HOME/.zshrc." + elif [[ "$SHELL" =~ "bash" ]]; then + echo 'export PATH=$PATH:'$DIR >> $HOME/.bashrc + source "$HOME/.bashrc" + echo "[ OK ] Bash shell detected, added $DIR/ to $HOME/.bashrc." else echo "[WARN] Shell could not be detected, you will need to manually add $DIR to your PATH." fi