Skip to content

Commit 21f008c

Browse files
authored
Merge pull request #316 from per1234/fix-install-script
Fix install script's check for previous installation
2 parents f47ecd0 + d2e1437 commit 21f008c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

etc/install.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -186,19 +186,19 @@ bye() {
186186

187187
testVersion() {
188188
set +e
189-
EXECUTABLE_PATH="$(command -v $PROJECT_NAME)"
190-
if [ "$?" = "1" ]; then
191-
# $PATH is intentionally a literal in this message.
192-
# shellcheck disable=SC2016
193-
echo "$PROJECT_NAME not found. You might want to add \"$EFFECTIVE_BINDIR\" to your "'$PATH'
194-
else
189+
if EXECUTABLE_PATH="$(command -v $PROJECT_NAME)"; then
195190
# Convert to resolved, absolute paths before comparison
196191
EXECUTABLE_REALPATH="$(cd -- "$(dirname -- "$EXECUTABLE_PATH")" && pwd -P)"
197192
EFFECTIVE_BINDIR_REALPATH="$(cd -- "$EFFECTIVE_BINDIR" && pwd -P)"
198193
if [ "$EXECUTABLE_REALPATH" != "$EFFECTIVE_BINDIR_REALPATH" ]; then
194+
# $PATH is intentionally a literal in this message.
199195
# shellcheck disable=SC2016
200196
echo "An existing $PROJECT_NAME was found at $EXECUTABLE_PATH. Please prepend \"$EFFECTIVE_BINDIR\" to your "'$PATH'" or remove the existing one."
201197
fi
198+
else
199+
# $PATH is intentionally a literal in this message.
200+
# shellcheck disable=SC2016
201+
echo "$PROJECT_NAME not found. You might want to add \"$EFFECTIVE_BINDIR\" to your "'$PATH'
202202
fi
203203

204204
set -e

0 commit comments

Comments
 (0)