Jeeaaasus / youtube-dl

Automated yt-dlp Docker image
https://hub.docker.com/r/jeeaaasustest/youtube-dl/
MIT License
258 stars 33 forks source link

UMASK #62

Closed tonyhardcode closed 2 years ago

tonyhardcode commented 2 years ago

Can we get a docker environment variable for UMASK? The files downloaded by youtube-dl cannot be deleted using the user/group variables.

benfishbus commented 2 years ago

Until this feature gets added, you can set it manually in /etc/services.d/youtube-dl/run by inserting a line with umask 000 (or whatever mask you want) right above the exec line.

I map an edited copy of the script into the container as a volume so the change survives container updates.

(If I really knew what I was doing, I'd submit a pull request and contribute a proper change utilizing an environment variable.)

benfishbus commented 2 years ago

Ok, I feel guilty recommending this approach :-) I threw together this extra init script to insert the umask command and the value of environment variable $UMASK, which can be set in docker run/compose.

98-UMASK

#!/usr/bin/with-contenv sh

sed -i 's/.*sleep 30.*/&\numask '"$UMASK"'/' /etc/services.d/youtube-dl/run

echo "
UMASK 
---------------------------------------
youtube-dl will run with umask $UMASK
---------------------------------------
"
Jeeaaasus commented 2 years ago

Hi there @benfishbus, thank you for the help, I had no idea it was this easy! Hopefully I understood and implemented this correctly. Please reopen issue if needed! :) Keep in mind, this change is added to the 'unstable' image right away but only to 'latest' with the next yt-dlp release.