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 '''))