This commit is contained in:
Thomas Forgione 2020-11-14 19:05:33 +01:00
parent 816d51369b
commit 2c47bb794e
1 changed files with 13 additions and 14 deletions

View File

@ -33,7 +33,13 @@ echo_green() {
}
test_command() {
command -v $1 > /dev/null 2>&1
for i in $@; do
command -v $i > /dev/null 2>&1
res=$?
if [ $res -ne 0 ]; then
return $res
fi
done
}
yes_no_ask_required() {
@ -57,23 +63,24 @@ yes_no_ask() {
install() {
test_command apt
if [ $? -eq 0 ]; then
sudo apt install -yqq $1
sudo apt install -yqq $@
return
fi
test_command pacman
if [ $? -eq 0 ]; then
sudo pacman -S $1
sudo pacman -S $@
return
fi
error "distribution not recognized, can't install $1."
error "distribution not recognized, can't install $@."
}
remove() {
test_command apt
if [ $? -eq 0 ]; then
sudo apt purge -yqq $1
sudo apt autoremove -yqq
return
fi
@ -121,14 +128,6 @@ install_python_neovim() {
install_neovim() {
test_command apt
if [ $? -eq 0 ]; then
test_command add-apt-repository
if [ $? -ne 0 ]; then
sudo apt update -qq && sudo apt install -yqq software-properties-common
fi
sudo add-apt-repository -y ppa:neovim-ppa/stable
sudo apt update -yqq
sudo apt install -yqq neovim
return
fi
@ -144,7 +143,7 @@ install_neovim() {
git_clone() {
info_n "cloning $1..."
git clone $1 $2 > /dev/null 2>&1
git clone $@ > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo " OK!"
else
@ -329,7 +328,7 @@ configure_neovim() {
fi
# Try and install python3 and python-neovim
test_command python3
test_command python3 pip3
if [ $? -ne 0 ]; then
install_python3
fi