Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64

## Versions

* **02.08.19:** - Attempt to automatically fix permissions on /dev/dri and /dev/dvb.
* **28.06.19:** - Rebasing to alpine 3.10.
* **27.03.19:** - Rebase to Alpine 3.9, fix init logic to only chown once.
* **23.03.19:** - Switching to new Base images, shift to arm32v7 tag.
Expand Down
1 change: 1 addition & 0 deletions readme-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ app_setup_block: |

# changelog
changelogs:
- { date: "02.08.19:", desc: "Attempt to automatically fix permissions on /dev/dri and /dev/dvb." }
- { date: "28.06.19:", desc: "Rebasing to alpine 3.10." }
- { date: "27.03.19:", desc: "Rebase to Alpine 3.9, fix init logic to only chown once." }
- { date: "23.03.19:", desc: "Switching to new Base images, shift to arm32v7 tag." }
Expand Down
34 changes: 34 additions & 0 deletions root/etc/cont-init.d/50-gid-video
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/with-contenv bash

# check for the existence of a video and/or tuner device
if [ -e /dev/dri ] || [ -e /dev/dvb ]; then
if [ -e /dev/dri ]; then
VIDEO_GID=$(stat -c '%g' /dev/dri/* | grep -v '^0$' | head -n 1)
else
VIDEO_GID=$(stat -c '%g' /dev/dvb/* | grep -v '^0$' | head -n 1)
fi
# just add abc to root if stuff in dri/dvb is root owned
if [ -z "${VIDEO_GID}" ]; then
usermod -a -G root abc
exit 0
fi
else
exit 0
fi

# Check if this GID matches the current abc user
ABCGID=$(getent group abc | awk -F: '{print $3}')
if [ "${ABCGID}" == "${VIDEO_GID}" ]; then
exit 0
fi

# Check if the GID is taken and swap to 65533
CURRENT=$(getent group ${VIDEO_GID} | awk -F: '{print $1}')
if [ -z "${CURRENT}" ] || [ "${CURRENT}" == 'video' ]; then
groupmod -g ${VIDEO_GID} video
usermod -a -G video abc
else
groupmod -g 65533 ${CURRENT}
groupmod -g ${VIDEO_GID} video
usermod -a -G video abc
fi