]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Use package cache from /root if we're running as root from /root
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 8 Sep 2024 14:37:16 +0000 (16:37 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 9 Sep 2024 16:15:23 +0000 (18:15 +0200)
mkosi/user.py

index e44707d5278fac0d76fa7f76487164a6aa4dd365..407d981c27007477e458c8dc770be3a6dbb71e3d 100644 (file)
@@ -50,6 +50,8 @@ class INVOKING_USER:
             cache = Path(env)
         elif cls.is_regular_user(os.getuid()) and cls.home() != Path("/"):
             cache = cls.home() / ".cache"
+        elif os.getuid() == 0 and Path.cwd().is_relative_to("/root") and "XDG_SESSION_ID" in os.environ:
+            cache = Path("/root/.cache")
         else:
             cache = Path("/var/cache")