Skip to content

Commit b7902f3

Browse files
authored
Updated installer script (#16)
1 parent 9f0a68b commit b7902f3

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

install.sh

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set -e
88
readonly projectName="MontFerret"
99
readonly appName="cli"
1010
readonly binName="ferret"
11-
readonly fullAppName="${projectName} $(echo ${appName} | awk '{print toupper(substr($0,0,1)) substr($0,2)}')"
11+
readonly fullAppName="Ferret CLI"
1212
readonly baseUrl="https://github.com/${projectName}/${appName}/releases/download"
1313

1414
# Declare default values
@@ -74,7 +74,7 @@ detect_profile() {
7474
local detected_profile=""
7575

7676
if [ "${PROFILE-}" = '/dev/null' ]; then
77-
# the user has specifically requested NOT to have nvm touch their profile
77+
# the user has specifically requested NOT to have us touch their profile
7878
return
7979
fi
8080

@@ -96,7 +96,7 @@ detect_profile() {
9696
fi
9797

9898
if [ -z "$detected_profile" ]; then
99-
for profile_name in ".profile" ".bashrc" ".bash_profile" ".zshrc"; do
99+
for profile_name in ".zshrc" ".bashrc" ".bash_profile" ".profile"; do
100100
if detected_profile="$(check_path "${HOME}/${profile_name}")"; then
101101
break
102102
fi
@@ -113,7 +113,15 @@ update_profile() {
113113
local location="$1"
114114
local profile="$(detect_profile)"
115115

116-
if [[ ":$PATH:" == *":$location:"* ]]; then
116+
if [ -z "$profile" ]; then
117+
report "No profile found. Skipping PATH update."
118+
return
119+
fi
120+
121+
report "Checking if $location is already in PATH"
122+
123+
if echo ":$PATH:" | grep -q ":$location:"; then
124+
report "$location is already in PATH"
117125
return
118126
fi
119127

0 commit comments

Comments
 (0)