mirror of
https://github.com/linuxserver/docker-jellyfin.git
synced 2025-10-27 03:03:38 +09:00
Merge pull request #243 from linuxserver/init-video
increase verbosity of init-video
This commit is contained in:
@@ -371,7 +371,8 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
|
||||
|
||||
## Versions
|
||||
|
||||
* **12.02.24:** - Use universal hardware acceleration blurb
|
||||
* **01.05.24:** - Increase verbosity of device permissions fixing.
|
||||
* **12.02.24:** - Use universal hardware acceleration blurb.
|
||||
* **12.09.23:** - Take ownership of plugin directories.
|
||||
* **04.07.23:** - Deprecate armhf. As announced [here](https://www.linuxserver.io/blog/a-farewell-to-arm-hf)
|
||||
* **07.12.22:** - Rebase master to Jammy, migrate to s6v3.
|
||||
|
||||
@@ -27,8 +27,6 @@ param_usage_include_ports: true
|
||||
param_ports:
|
||||
- {external_port: "8096", internal_port: "8096", port_desc: "Http webUI."}
|
||||
param_usage_include_env: true
|
||||
param_env_vars:
|
||||
- {env_var: "TZ", env_value: "Europe/London", desc: "Specify a timezone to use (e.g. Europe/London)."}
|
||||
# optional container parameters
|
||||
opt_param_usage_include_env: true
|
||||
opt_param_env_vars:
|
||||
@@ -104,7 +102,8 @@ readme_hwaccel: true
|
||||
unraid_template_sync: false
|
||||
# changelog
|
||||
changelogs:
|
||||
- {date: "12.02.24:", desc: "Use universal hardware acceleration blurb"}
|
||||
- {date: "01.05.24:", desc: "Increase verbosity of device permissions fixing."}
|
||||
- {date: "12.02.24:", desc: "Use universal hardware acceleration blurb."}
|
||||
- {date: "12.09.23:", desc: "Take ownership of plugin directories."}
|
||||
- {date: "04.07.23:", desc: "Deprecate armhf. As announced [here](https://www.linuxserver.io/blog/a-farewell-to-arm-hf)"}
|
||||
- {date: "07.12.22:", desc: "Rebase master to Jammy, migrate to s6v3."}
|
||||
|
||||
@@ -3,19 +3,33 @@
|
||||
|
||||
FILES=$(find /dev/dri /dev/dvb /dev/vchiq /dev/vc-mem /dev/video1? -type c -print 2>/dev/null)
|
||||
|
||||
for i in $FILES
|
||||
do
|
||||
VIDEO_GID=$(stat -c '%g' "$i")
|
||||
if ! id -G abc | grep -qw "$VIDEO_GID"; then
|
||||
VIDEO_NAME=$(getent group "${VIDEO_GID}" | awk -F: '{print $1}')
|
||||
if [[ -z "${VIDEO_NAME}" ]]; then
|
||||
VIDEO_NAME="video$(head /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c8)"
|
||||
groupadd "$VIDEO_NAME"
|
||||
groupmod -g "$VIDEO_GID" "$VIDEO_NAME"
|
||||
for i in ${FILES}; do
|
||||
VIDEO_GID=$(stat -c '%g' "${i}")
|
||||
VIDEO_UID=$(stat -c '%u' "${i}")
|
||||
# check if user matches device
|
||||
if id -u abc | grep -qw "${VIDEO_UID}"; then
|
||||
echo "**** permissions for ${i} are good ****"
|
||||
else
|
||||
# check if group matches and that device has group rw
|
||||
if id -G abc | grep -qw "${VIDEO_GID}" && [[ $(stat -c '%A' "${i}" | cut -b 5,6) == "rw" ]]; then
|
||||
echo "**** permissions for ${i} are good ****"
|
||||
# check if device needs to be added to video group
|
||||
elif ! id -G abc | grep -qw "${VIDEO_GID}"; then
|
||||
# check if video group needs to be created
|
||||
VIDEO_NAME=$(getent group "${VIDEO_GID}" | awk -F: '{print $1}')
|
||||
if [[ -z "${VIDEO_NAME}" ]]; then
|
||||
VIDEO_NAME="video$(head /dev/urandom | tr -dc 'a-z0-9' | head -c4)"
|
||||
groupadd "${VIDEO_NAME}"
|
||||
groupmod -g "${VIDEO_GID}" "${VIDEO_NAME}"
|
||||
echo "**** creating video group ${VIDEO_NAME} with id ${VIDEO_GID} ****"
|
||||
fi
|
||||
echo "**** adding ${i} to video group ${VIDEO_NAME} with id ${VIDEO_GID} ****"
|
||||
usermod -a -G "${VIDEO_NAME}" abc
|
||||
fi
|
||||
usermod -a -G "$VIDEO_NAME" abc
|
||||
if [ $(stat -c '%A' "${i}" | cut -b 5,6) != "rw" ]; then
|
||||
echo -e "**** The device ${i} does not have group read/write permissions, which might prevent hardware transcode from functioning correctly. To fix it, you can run the following on your docker host: ****\nsudo chmod g+rw ${i}\n"
|
||||
# check if device has group rw
|
||||
if [[ $(stat -c '%A' "${i}" | cut -b 5,6) != "rw" ]]; then
|
||||
echo -e "**** The device ${i} does not have group read/write permissions, attempting to fix inside the container. ****"
|
||||
chmod g+rw "${i}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user