about summary refs log tree commit diff homepage
path: root/scripts/build/common-functions
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/build/common-functions')
-rw-r--r--scripts/build/common-functions9
1 files changed, 9 insertions, 0 deletions
diff --git a/scripts/build/common-functions b/scripts/build/common-functions
index 6d810d73..c964419f 100644
--- a/scripts/build/common-functions
+++ b/scripts/build/common-functions
@@ -30,4 +30,13 @@ function get_git_hash() {
   else
     echo "${commit_id:0:7}"
   fi
+}
+
+function with_sudo() {
+    echo "Checking sudo $@"
+    if [[ $(whoami) != "root" ]]; then
+        sudo "$@"
+    else
+        "$@"
+    fi
 }
\ No newline at end of file