Update install script

This commit is contained in:
Junegunn Choi 2015-01-17 20:40:00 +09:00
parent 30f9651f99
commit a3101120fd

10
install
View File

@ -16,6 +16,7 @@ check_binary() {
local output=$("$fzf_base"/bin/fzf --version 2>&1) local output=$("$fzf_base"/bin/fzf --version 2>&1)
if [ "$version" = "$output" ]; then if [ "$version" = "$output" ]; then
echo "$output" echo "$output"
binary_error=""
else else
echo "$output != $version" echo "$output != $version"
rm -f "$fzf_base"/bin/fzf rm -f "$fzf_base"/bin/fzf
@ -27,8 +28,12 @@ check_binary() {
symlink() { symlink() {
echo " - Creating symlink: bin/$1 -> bin/fzf" echo " - Creating symlink: bin/$1 -> bin/fzf"
(cd "$fzf_base"/bin && (cd "$fzf_base"/bin &&
rm -f fzf rm -f fzf &&
ln -sf $1 fzf) ln -sf $1 fzf)
if [ $? -ne 0 ]; then
binary_error="Failed to create symlink"
return 1
fi
} }
download() { download() {
@ -37,8 +42,7 @@ download() {
echo " - Already exists" echo " - Already exists"
check_binary && return check_binary && return
elif [ -x "$fzf_base"/bin/$1 ]; then elif [ -x "$fzf_base"/bin/$1 ]; then
symlink $1 symlink $1 && check_binary && return
check_binary && return
fi fi
mkdir -p "$fzf_base"/bin && cd "$fzf_base"/bin mkdir -p "$fzf_base"/bin && cd "$fzf_base"/bin
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then