Skip to content

Commit d05d33f

Browse files
committed
dist/tools/tapsetup: make compatible with doas
`doas` doesn't set `SUDO_USER`, but `DOAS_USER`. This populates `SUDO_USER` with `DOAS_USER` if it is empty, so the script works with both doas and sudo.
1 parent 251ea7f commit d05d33f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

dist/tools/tapsetup/tapsetup

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ BRIDGE_ROUTES=""
1313
DEFAULT_PREFIX_LEN=128
1414
UPLINK=""
1515

16+
# doas uses the DOAS_USER variable instead of SUDO_USER. For compatibility with
17+
# both, we populate SUDO_USER with DOAS_USER, if SUDO_USER is not existing.
18+
: "${SUDO_USER:="$DOAS_USER"}"
19+
1620
usage() {
1721
echo "usage: ${PROGRAM} [arguments]" >&2
1822
echo "" >&2

0 commit comments

Comments
 (0)