summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-10-26 12:31:43 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-10-26 12:31:43 +0900
commit724ffa3756adb5913ae0ff042d0708c90a80948f (patch)
tree0a0e89bf1037a75c767fb60730eda6b7d2656d0e /install
parent5694b5ed30454f26f5741ab43a803b9a726a511d (diff)
[install] Do not download binary if it's found in $PATH (#373)
/cc @xconstruct
Diffstat (limited to 'install')
-rwxr-xr-xinstall9
1 files changed, 8 insertions, 1 deletions
diff --git a/install b/install
index 64257135..62780f4d 100755
--- a/install
+++ b/install
@@ -103,9 +103,16 @@ download() {
if [ -x "$fzf_base"/bin/fzf ]; then
echo " - Already exists"
check_binary && return
- elif [ -x "$fzf_base"/bin/$1 ]; then
+ fi
+ if [ -x "$fzf_base"/bin/$1 ]; then
symlink $1 && check_binary && return
fi
+ if which_fzf="$(which fzf 2> /dev/null)"; then
+ echo " - Found in \$PATH"
+ echo " - Creating symlink: $which_fzf -> bin/fzf"
+ (cd "$fzf_base"/bin && rm -f fzf && ln -sf "$which_fzf" fzf)
+ check_binary && return
+ fi
fi
mkdir -p "$fzf_base"/bin && cd "$fzf_base"/bin
if [ $? -ne 0 ]; then