aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLena <lena@omega>2026-07-01 00:00:00 +0000
committerLena <lena@omega>2026-07-01 00:00:00 +0000
commit1cd6695315d52b4d5417fbb9fb8ad3b8c0063104 (patch)
tree9568a360bf9fe85cbe1c8a2f53ffbe1cde634028
parente89c2290de133104420b02da3b7453a25484429d (diff)
downloadscrcpy-android-1cd6695315d52b4d5417fbb9fb8ad3b8c0063104.tar.gz
test: pass /dev/kvm's gid to docker numerically
Group names resolved on the host do not exist inside the container, so the "kvm" fallback broke --group-add on hosts where getent found no kvm group. stat the device instead; the numeric gid is all that matters and /dev/kvm is already known to exist at this point.
-rwxr-xr-xtest8
1 files changed, 4 insertions, 4 deletions
diff --git a/test b/test
index de6eaf6..7ccfc8f 100755
--- a/test
+++ b/test
@@ -69,10 +69,10 @@ if [ -n "$needs_kvm" ]; then
echo " sudo usermod -aG kvm $(id -un)" >&2
exit 3
fi
- # Pass through the host's kvm gid so the container user (mapped to
- # host uid:gid) can actually open /dev/kvm.
- kvm_gid=$(getent group kvm | awk -F: '{print $3}')
- kvm_args="--device /dev/kvm --group-add ${kvm_gid:-kvm}"
+ # Pass through /dev/kvm's owning gid (numeric - group names from the
+ # host don't exist inside the container) so the container user
+ # (mapped to host uid:gid) can actually open it.
+ kvm_args="--device /dev/kvm --group-add $(stat -c %g /dev/kvm)"
fi
# Forward Ctrl-C cleanly, run as the host user so files in .tools/ stay