From 8bf4182f862c4d6499f4ca9ded4a5b33553b14c3 Mon Sep 17 00:00:00 2001 From: nvbn Date: Sat, 5 Sep 2015 11:54:59 +0300 Subject: [PATCH] Fix install script on non-ubuntu --- install.sh | 8 ++++++-- tests/functional/test_install.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index e115f01b..af29e9bf 100755 --- a/install.sh +++ b/install.sh @@ -4,8 +4,12 @@ should_add_alias () { [ -f $1 ] && ! grep -q thefuck $1 } +installed () { + hash $1 2>/dev/null +} + # Install os dependencies: -if [ -f $(which apt-get) ]; then +if installed apt-get; then # Debian/ubuntu: sudo apt-get update -yy sudo apt-get install -yy python-pip python-dev command-not-found @@ -15,7 +19,7 @@ if [ -f $(which apt-get) ]; then sudo apt-get install -yy python-commandnotfound fi else - if [ -f $(which brew) ]; then + if installed brew; then # OS X: brew update brew install python diff --git a/tests/functional/test_install.py b/tests/functional/test_install.py index b1867f62..cd4b9faa 100644 --- a/tests/functional/test_install.py +++ b/tests/functional/test_install.py @@ -8,7 +8,7 @@ RUN apt-get update RUN apt-get install -yy bash '''), (u'bash', 'generic-bash', u''' FROM fedora:latest -RUN dnf install -yy python-devel sudo which gcc +RUN dnf install -yy python-devel sudo wget gcc '''))