diff --git a/docker/entrypoint.py b/docker/entrypoint.py index bad20ba..1dfac28 100644 --- a/docker/entrypoint.py +++ b/docker/entrypoint.py @@ -25,6 +25,19 @@ if os.geteuid() == 0 and puid: subprocess.run( ["chown", "-R", f"{puid}:{pgid or puid}", config_dir], check=False ) + # Entree passwd pour PUID: certains binaires (MakeMKV) resolvent le + # repertoire utilisateur via getpwuid et non via $HOME. Sans entree, + # makemkvcon ne trouve pas sa configuration (/config/.MakeMKV). + try: + with open("/etc/passwd", encoding="utf-8") as handle: + known_uids = {line.split(":")[2] for line in handle if ":" in line} + if str(puid) not in known_uids: + with open("/etc/passwd", "a", encoding="utf-8") as handle: + handle.write( + f"mkvtool:x:{puid}:{pgid or puid}::{config_dir}:/usr/sbin/nologin\n" + ) + except OSError: + pass os.setgroups([pgid] if pgid else []) if pgid: os.setgid(pgid)