allow to add the /dev/dri device into the container and refactor devices

Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
Simon L 2023-01-03 02:01:03 +01:00
parent 7237433548
commit 92b271c3e5
11 changed files with 72 additions and 2 deletions

View file

@ -30,6 +30,18 @@ if [ -n "$TRUSTED_CACERTS_DIR" ]; then
update-ca-certificates
fi
# Check if /dev/dri device is present and apply correct permissions
set -x
if ! [ -f "/dev-dri-group-was-added" ] && [ -n "$(find /dev -maxdepth 1 -mindepth 1 -name dri)" ] && [ -n "$(find /dev/dri -maxdepth 1 -mindepth 1 -name renderD128)" ]; then
# From https://github.com/pulsejet/memories/wiki/QSV-Transcoding#docker-installations
GID="$(stat -c "%g" /dev/dri/renderD128)"
groupadd -g "$GID" render2 || true # sometimes this is needed
GROUP="$(getent group "$GID" | cut -d: -f1)"
usermod -aG "$GROUP" www-data
touch "/dev-dri-group-was-added"
fi
set +x
# Check datadir permissions
sudo -u www-data touch "$NEXTCLOUD_DATA_DIR/this-is-a-test-file" &>/dev/null
if ! [ -f "$NEXTCLOUD_DATA_DIR/this-is-a-test-file" ]; then