Skip to content

Commit 3eecda0

Browse files
committed
use more precise matching for group detection
1 parent 343b1a8 commit 3eecda0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

bin/build_container

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@ if [ $NEED_SUDO -eq 0 ]; then
3636
FAKEROOT=--fakeroot
3737
echo "Using fakeroot"
3838
else
39-
if [[ ! -z "$GITHUB_RUN_ID" || `groups` == *"sudo"* || `groups` == *"wheel"* ]]; then
39+
if [[ -n "$GITHUB_RUN_ID" || $(groups) =~ (^|[[:space:]])(sudo|wheel)([[:space:]]|$) ]]; then
4040
# user has sudo permission
4141
SUDO=sudo
4242
FAKEROOT=""
43+
echo "Using sudo"
4344
else
4445
echo "You appear to have neither namespace or sudo permission. You need one to build."
4546
echo " Either: "
@@ -51,6 +52,8 @@ else
5152
fi
5253
fi
5354

55+
exit
56+
5457
# make container home directory (~)
5558
if [ ! -d "${ROOT}/.home" ]; then
5659
mkdir -p ${ROOT}/.home

0 commit comments

Comments
 (0)