mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-20 02:20:06 +01:00
17 lines
382 B
Bash
Executable file
17 lines
382 B
Bash
Executable file
#!/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
|
|
|