blob: a9019bc320cddd87f542c56be59485c5393b63b2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#!/bin/bash
CMD="$1"
shift;
if [[ $UID == 0 ]]; then
# we are already root. Execute directly.
exec "$CMD" "$@"
elif [[ "$NMTST_SUDO_NO_CALL_SELF" != "" ]]; then
# when setting $NMTST_SUDO_NO_CALL_SELF, pass the (resolved) command
# directly to sudo.
exec sudo "$CMD" "$@"
else
# by default, call self again with sudo.
exec sudo -E "$0" "$CMD" "$@"
fi
|