From: Joerg Behrmann Date: Wed, 29 Nov 2023 10:20:08 +0000 (+0100) Subject: mounts: use INVOKING_USER in mount_passwd instead of hardcoding /home X-Git-Tag: v20~124^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2084%2Fhead;p=thirdparty%2Fmkosi.git mounts: use INVOKING_USER in mount_passwd instead of hardcoding /home --- diff --git a/mkosi/mounts.py b/mkosi/mounts.py index 61e687790..c8e6f25ca 100644 --- a/mkosi/mounts.py +++ b/mkosi/mounts.py @@ -157,7 +157,8 @@ def mount_passwd(root: Path = Path("/")) -> Iterator[None]: passwd.write("root:x:0:0:root:/root:/bin/sh\n") if INVOKING_USER.uid != 0: name = INVOKING_USER.name() - passwd.write(f"{name}:x:{INVOKING_USER.uid}:{INVOKING_USER.gid}:{name}:/home/{name}:/bin/sh\n") + home = INVOKING_USER.home() + passwd.write(f"{name}:x:{INVOKING_USER.uid}:{INVOKING_USER.gid}:{name}:{home}:/bin/sh\n") passwd.flush() os.fchown(passwd.file.fileno(), INVOKING_USER.uid, INVOKING_USER.gid)