From 9944b3623aa79501b325cacf3fa665f3aa54518d Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Wed, 12 Aug 2020 14:00:14 +0100 Subject: [PATCH] updated bootstrap.sh --- setup/bootstrap.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/setup/bootstrap.sh b/setup/bootstrap.sh index d49dae61..343a43ed 100755 --- a/setup/bootstrap.sh +++ b/setup/bootstrap.sh @@ -29,20 +29,23 @@ repo="https://github.com/HariSekhon/DevOps-Bash-tools" directory="bash-tools" +sudo="" +[ "$(whoami)" != "root" ] || sudo=sudo + if [ "$(uname -s)" = Darwin ]; then echo "Bootstrapping Mac" if ! type brew >/dev/null 2>&1; then - curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install | ruby + curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install | $sudo ruby fi elif [ "$(uname -s)" = Linux ]; then echo "Bootstrapping Linux" if type apk >/dev/null 2>&1; then - apk --no-cache add bash git make + $sudo apk --no-cache add bash git make elif type apt-get >/dev/null 2>&1; then - apt-get update - apt-get install -y git make + $sudo apt-get update + $sudo apt-get install -y git make elif type yum >/dev/null 2>&1; then - yum install -y git make + $sudo yum install -y git make else echo "Package Manager not found on Linux, cannot bootstrap" exit 1 @@ -61,4 +64,4 @@ else cd "$directory" fi -make +make install