From e32c71cdeb3a9efc962ab81bdbdb28cacf7a5399 Mon Sep 17 00:00:00 2001 From: Sean McGary Date: Tue, 8 Oct 2024 11:21:18 -0500 Subject: [PATCH] Optional sudo so that github actions will work --- scripts/installDeps.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/scripts/installDeps.sh b/scripts/installDeps.sh index 2faa9ddc..1f4870c5 100755 --- a/scripts/installDeps.sh +++ b/scripts/installDeps.sh @@ -3,9 +3,22 @@ OS=$(uname -s | tr '[:upper:]' '[:lower:]') ARCH=$(uname -a | tr '[:upper:]' '[:lower:]') +command_exists() { + command -v "$@" > /dev/null 2>&1 +} + +apt_update_and_install() { + if command_exists sudo; then + sudo apt-get update + sudo apt-get install "$@" + else + apt-get update + apt-get install "$@" + fi +} + if [[ "$OS" == "linux" ]]; then - apt-get update - apt-get install -y \ + apt_update_and_install -y \ make \ curl \ git \