diff options
| author | Lena <lena@omega> | 2026-07-01 00:00:00 +0000 |
|---|---|---|
| committer | Lena <lena@omega> | 2026-07-01 00:00:00 +0000 |
| commit | 1cd6695315d52b4d5417fbb9fb8ad3b8c0063104 (patch) | |
| tree | 9568a360bf9fe85cbe1c8a2f53ffbe1cde634028 /test | |
| parent | e89c2290de133104420b02da3b7453a25484429d (diff) | |
| download | scrcpy-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.
Diffstat (limited to 'test')
| -rwxr-xr-x | test | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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 |