Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
m1k1o
GitHub Repository: m1k1o/neko
Path: blob/master/runtime/intel/add-render-group.sh
1300 views
1
#!/bin/bash
2
3
# if no hwenc required, noop
4
[[ -z "$NEKO_HWENC" ]] && exit 0
5
6
if [[ -z "$RENDER_GID" ]]; then
7
RENDER_GID=$(stat -c "%g" /dev/dri/render* | tail -n 1)
8
# is /dev/dri passed to the container?
9
[[ -z "$RENDER_GID" ]] && exit 1
10
fi
11
12
# note that this could conceivably be a security risk...
13
cnt_group=$(getent group "$RENDER_GID" | cut -d: -f1)
14
if [[ -z "$cnt_group" ]]; then
15
groupadd -g "$RENDER_GID" nekorender
16
cnt_group=nekorender
17
fi
18
usermod -a -G "$cnt_group" "$USER"
19
20