diff options
author | Martin Nowack <m.nowack@imperial.ac.uk> | 2022-03-25 22:57:31 +0000 |
---|---|---|
committer | Cristian Cadar <c.cadar@imperial.ac.uk> | 2022-03-30 12:18:59 +0100 |
commit | 818275b7249250780ddd5ed021cae64288514270 (patch) | |
tree | 9ed884e1db33bb33ce992dc6afeaff75ee85f81b /scripts/build/common-functions | |
parent | 71c1c45fe266d73e307f422f09f2afdc41c70ec3 (diff) | |
download | klee-818275b7249250780ddd5ed021cae64288514270.tar.gz |
Add support to `sudo` if necessary
Instead if executing system-relevant changes directly, use `sudo` on Ubuntu-based machines. Simplifies the installation procedure.
Diffstat (limited to 'scripts/build/common-functions')
-rw-r--r-- | scripts/build/common-functions | 9 |
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 |