From fd837a9ce57dc0f2326843db021eebc1a4aa89c0 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 20:37:15 +0000 Subject: [PATCH] chore: selectively use sudo --- runtime/experiments/bimodal/install.sh | 9 ++++++++- runtime/experiments/concurrency/install.sh | 9 ++++++++- runtime/experiments/payload/install.sh | 9 ++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/runtime/experiments/bimodal/install.sh b/runtime/experiments/bimodal/install.sh index 58e6106..d5ec913 100755 --- a/runtime/experiments/bimodal/install.sh +++ b/runtime/experiments/bimodal/install.sh @@ -2,5 +2,12 @@ if ! command -v hey; then HEY_URL=https://hey-release.s3.us-east-2.amazonaws.com/hey_linux_amd64 - wget $HEY_URL -O hey && chmod +x hey && sudo mv hey /usr/bin/hey + wget $HEY_URL -O hey + chmod +x hey + + if [[ $(whoami) == "root" ]]; then + mv hey /usr/bin/hey + else + sudo mv hey /usr/bin/hey + fi fi diff --git a/runtime/experiments/concurrency/install.sh b/runtime/experiments/concurrency/install.sh index 58e6106..d5ec913 100755 --- a/runtime/experiments/concurrency/install.sh +++ b/runtime/experiments/concurrency/install.sh @@ -2,5 +2,12 @@ if ! command -v hey; then HEY_URL=https://hey-release.s3.us-east-2.amazonaws.com/hey_linux_amd64 - wget $HEY_URL -O hey && chmod +x hey && sudo mv hey /usr/bin/hey + wget $HEY_URL -O hey + chmod +x hey + + if [[ $(whoami) == "root" ]]; then + mv hey /usr/bin/hey + else + sudo mv hey /usr/bin/hey + fi fi diff --git a/runtime/experiments/payload/install.sh b/runtime/experiments/payload/install.sh index 58e6106..d5ec913 100755 --- a/runtime/experiments/payload/install.sh +++ b/runtime/experiments/payload/install.sh @@ -2,5 +2,12 @@ if ! command -v hey; then HEY_URL=https://hey-release.s3.us-east-2.amazonaws.com/hey_linux_amd64 - wget $HEY_URL -O hey && chmod +x hey && sudo mv hey /usr/bin/hey + wget $HEY_URL -O hey + chmod +x hey + + if [[ $(whoami) == "root" ]]; then + mv hey /usr/bin/hey + else + sudo mv hey /usr/bin/hey + fi fi