File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 24
24
# setup Bash environment
25
25
set -euf -o pipefail
26
26
27
- # setup sudo
27
+
28
+ # handle following scenarios:
29
+ # * unprivileged user (i.e. not root, sudo not used)
30
+ # * privileged user (i.e. not root, sudo used)
31
+ # * root user (i.e. sudo not used)
28
32
SUDO=' '
29
33
if [[ $( id -u) -ne 0 ]]; then
34
+ # verify that 'sudo' is present before assuming we can use it
35
+ if [[ ! -x $( which sudo 2> /dev/null) ]]; then
36
+ echo " [-] Dependencies unmet. Please verify that 'sudo' is installed, executable, and in the PATH." >&2
37
+ echo " Alternatively, you may also re-run this script as root." >&2
38
+ exit 1
39
+ fi
40
+
30
41
SUDO=' sudo'
31
42
fi
32
43
44
+
33
45
# ##############################################################################
34
46
# constants
35
47
# ##############################################################################
You can’t perform that action at this time.
0 commit comments