]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
mounts: use INVOKING_USER in mount_passwd instead of hardcoding /home 2084/head
authorJoerg Behrmann <behrmann@physik.fu-berlin.de>
Wed, 29 Nov 2023 10:20:08 +0000 (11:20 +0100)
committerJoerg Behrmann <behrmann@physik.fu-berlin.de>
Wed, 29 Nov 2023 10:20:08 +0000 (11:20 +0100)
mkosi/mounts.py

index 61e687790c69e43e68f10534b653f39de72f0256..c8e6f25cae094da23e8630906e6f370a2c68ea8c 100644 (file)
@@ -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)