From 900d3156606ac23f017c99a3f363a0b3b5aefea0 Mon Sep 17 00:00:00 2001 From: Rajat Singhal Date: Tue, 5 Jan 2021 09:02:01 +0530 Subject: [PATCH] Only install packages if required on OSX --- setup.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index 6142975992..f1c2eca30d 100755 --- a/setup.sh +++ b/setup.sh @@ -9,6 +9,9 @@ downloadHighPolySuv=true MIN_CMAKE_VERSION=3.10.0 function version_less_than_equal_to() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" = "$1"; } +# brew gives error if package is already installed +function brew_install() { brew list $1 &>/dev/null || brew install $1; } + # Parse command line arguments while [[ $# -gt 0 ]] do @@ -63,7 +66,8 @@ if [ "$(uname)" == "Darwin" ]; then # osx sudo dseditgroup -o edit -a `whoami` -t user dialout fi - brew install wget coreutils + brew_install wget + brew_install coreutils if version_less_than_equal_to $cmake_ver $MIN_CMAKE_VERSION; then brew install cmake # should get cmake 3.8