Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

increase verbosity of init-video #243

Merged
merged 2 commits into from
May 3, 2024
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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 2 additions & 3 deletions readme-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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."}
Expand Down
38 changes: 26 additions & 12 deletions root/etc/s6-overlay/s6-rc.d/init-jellyfin-video/run
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down