Improve install script
This commit is contained in:
parent
f99f66570b
commit
23f27f3ce5
28
install
28
install
@ -12,21 +12,25 @@ ask() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
check_binary() {
|
check_binary() {
|
||||||
echo "- Checking fzf executable"
|
echo -n " - Checking fzf executable ... "
|
||||||
echo -n " - "
|
|
||||||
if ! "$fzf_base"/bin/fzf --version; then
|
if ! "$fzf_base"/bin/fzf --version; then
|
||||||
rm -v "$fzf_base"/bin/fzf
|
rm -f "$fzf_base"/bin/fzf
|
||||||
binary_error="Error occurred"
|
binary_error="Error occurred"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
symlink() {
|
||||||
|
echo " - Creating symlink: bin/$1 -> bin/fzf"
|
||||||
|
rm -f "$fzf_base"/bin/fzf
|
||||||
|
ln -sf "$fzf_base"/bin/$1 "$fzf_base"/bin/fzf
|
||||||
|
}
|
||||||
|
|
||||||
download() {
|
download() {
|
||||||
echo "Downloading fzf executable ($1) ..."
|
echo "Downloading bin/$1 ..."
|
||||||
if [ -x "$fzf_base"/bin/fzf ]; then
|
if [ -x "$fzf_base"/bin/$1 ]; then
|
||||||
if ! ask "- fzf already exists. Download it again?"; then
|
echo " - Already exists"
|
||||||
check_binary
|
symlink $1
|
||||||
return
|
check_binary && return
|
||||||
fi
|
|
||||||
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
|
||||||
@ -49,7 +53,7 @@ download() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mv $1 fzf && chmod +x fzf && check_binary
|
chmod +x $1 && symlink $1 && check_binary
|
||||||
}
|
}
|
||||||
|
|
||||||
# Try to download binary executable
|
# Try to download binary executable
|
||||||
@ -69,7 +73,7 @@ if [ -n "$binary_error" ]; then
|
|||||||
if [ $binary_available -eq 0 ]; then
|
if [ $binary_available -eq 0 ]; then
|
||||||
echo "No prebuilt binary for $archi ... "
|
echo "No prebuilt binary for $archi ... "
|
||||||
else
|
else
|
||||||
echo " - $binary_error ... "
|
echo " - $binary_error !!!"
|
||||||
fi
|
fi
|
||||||
echo "Installing legacy Ruby version ..."
|
echo "Installing legacy Ruby version ..."
|
||||||
|
|
||||||
@ -77,7 +81,7 @@ if [ -n "$binary_error" ]; then
|
|||||||
echo -n "Checking Ruby executable ... "
|
echo -n "Checking Ruby executable ... "
|
||||||
ruby=`which ruby`
|
ruby=`which ruby`
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "ruby executable not found!"
|
echo "ruby executable not found !!!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user