summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2016-07-16 00:36:35 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2016-07-16 00:36:35 +0900
commit6439a138feff689ddf6c81c66fb7ad48d4b31a2a (patch)
tree746fc97b8e34ec3af6a8810defd479aeb92022ce
parenta9a29dff4f7f2192ba5812e50b4c2efa23103efb (diff)
[install] Build fzf if prebuilt binary doesn't work
Close #617
-rwxr-xr-xinstall36
1 files changed, 20 insertions, 16 deletions
diff --git a/install b/install
index df6570c9..f658e1b0 100755
--- a/install
+++ b/install
@@ -9,6 +9,7 @@ auto_completion=
key_bindings=
update_config=2
binary_arch=
+allow_legacy=
help() {
cat << EOF
@@ -37,6 +38,7 @@ for opt in "$@"; do
auto_completion=1
key_bindings=1
update_config=1
+ allow_legacy=1
;;
--key-bindings) key_bindings=1 ;;
--no-key-bindings) key_bindings=0 ;;
@@ -165,6 +167,9 @@ case "$archi" in
esac
install_ruby_fzf() {
+ if [ -z "$allow_legacy" ]; then
+ ask "Do you want to install legacy Ruby version instead?" && exit 1
+ fi
echo "Installing legacy Ruby version ..."
# ruby executable
@@ -236,26 +241,25 @@ cd "$fzf_base"
if [ -n "$binary_error" ]; then
if [ $binary_available -eq 0 ]; then
echo "No prebuilt binary for $archi ..."
- if command -v go > /dev/null; then
- echo -n "Building binary (go get -u github.com/junegunn/fzf/src/fzf) ... "
- if [ -z "${GOPATH-}" ]; then
- export GOPATH="${TMPDIR:-/tmp}/fzf-gopath"
- mkdir -p "$GOPATH"
- fi
- if go get -u github.com/junegunn/fzf/src/fzf; then
- echo "OK"
- cp "$GOPATH/bin/fzf" "$fzf_base/bin/"
- else
- echo "Failed to build binary ..."
- install_ruby_fzf
- fi
+ else
+ echo " - $binary_error !!!"
+ fi
+ if command -v go > /dev/null; then
+ echo -n "Building binary (go get -u github.com/junegunn/fzf/src/fzf) ... "
+ if [ -z "${GOPATH-}" ]; then
+ export GOPATH="${TMPDIR:-/tmp}/fzf-gopath"
+ mkdir -p "$GOPATH"
+ fi
+ if go get -u github.com/junegunn/fzf/src/fzf; then
+ echo "OK"
+ cp "$GOPATH/bin/fzf" "$fzf_base/bin/"
else
- echo "go executable not found. Cannot build binary ..."
+ echo "Failed to build binary ..."
install_ruby_fzf
fi
else
- echo " - $binary_error !!!"
- exit 1
+ echo "go executable not found. Cannot build binary ..."
+ install_ruby_fzf
fi
fi