From d05d33f63655e8a1595b3dc33d37375afb73c02a Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Thu, 30 May 2024 09:38:44 +0200 Subject: [PATCH] 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. --- dist/tools/tapsetup/tapsetup | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dist/tools/tapsetup/tapsetup b/dist/tools/tapsetup/tapsetup index 6903544acb04..0ee6b7446b68 100755 --- a/dist/tools/tapsetup/tapsetup +++ b/dist/tools/tapsetup/tapsetup @@ -13,6 +13,10 @@ BRIDGE_ROUTES="" DEFAULT_PREFIX_LEN=128 UPLINK="" +# doas uses the DOAS_USER variable instead of SUDO_USER. For compatibility with +# both, we populate SUDO_USER with DOAS_USER, if SUDO_USER is not existing. +: "${SUDO_USER:="$DOAS_USER"}" + usage() { echo "usage: ${PROGRAM} [arguments]" >&2 echo "" >&2