From 134a1f48f9127b68cf1716dd1a6365b5d4c94549 Mon Sep 17 00:00:00 2001 From: Job Evers-Meltzer Date: Fri, 15 Jul 2016 16:05:30 -0500 Subject: [PATCH] only brew if not already installed Sometimes brew only warns, but other times it errors if you're installing something that is already installed, so lets be safe and only brew if its not already installed --- reproducible_build.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/reproducible_build.sh b/reproducible_build.sh index e6008f8a4..3faa177d7 100755 --- a/reproducible_build.sh +++ b/reproducible_build.sh @@ -166,16 +166,20 @@ function cleanup() { exit $rv } +function brew_if_not_installed() { + if ! brew ls | grep $1 --quiet; then + brew install $1 + fi +} + function install_brew_packages() { brew update > /dev/null - brew install autoconf - brew install automake - brew install libtool - brew install pkg-config - brew install protobuf - if ! brew ls | grep gmp --quiet; then - brew install gmp - fi + brew_if_not_installed autoconf + brew_if_not_installed automake + brew_if_not_installed libtool + brew_if_not_installed pkg-config + brew_if_not_installed protobuf + brew_if_not_installed gmp } function install_apt_packages() {