Skip to content

Commit 1d8df3d

Browse files
committed
fix: Portabilize check_doas() between UNIX utilities implementations.
1 parent feaad23 commit 1d8df3d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mitzune.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ function main {
3232
function check_doas {
3333
# doas will be necessary for now since i don't really know how to
3434
# work with namespaces in Linux for chroot'ing without root rights
35-
if $(grep "$USER" "$DOAS_CONF" &>/dev/null); then
35+
if $(grep "$(whoami)" "$DOAS_CONF" &>/dev/null); then
3636
function elevate { doas -- "$@"; }
3737
export -f elevate
3838
return
3939
elif [ $UID == 0 ]; then
4040
printerr 'Warning: running as root. This isn'\''t recommended.'
41-
elif $(id -nG $USER | grep 'wheel'); then
41+
elif $(groups $(whoami) | grep 'wheel'); then
4242
printerr 'Warning: %s can log directly as root, although using doas is better.' \
43-
"$USER"
43+
"$(whoami)"
4444
function elevate { su -c "$@"; }
4545
export -f elevate
4646
else

0 commit comments

Comments
 (0)