]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Check if systemd is actually running before using run0
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 6 Feb 2025 11:49:10 +0000 (12:49 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 6 Feb 2025 14:31:08 +0000 (15:31 +0100)
If we're not running systemd, we can't use run0 either, so use sudo
in that case.

mkosi/user.py

index 41186a695a331aa212d8114a9d063d083d0928ff..37ead626db0d3b1636f36e44ec69660c75433a1f 100644 (file)
@@ -189,4 +189,4 @@ def become_root_cmd() -> list[str]:
     if os.getuid() == 0:
         return []
 
-    return ["run0"] if find_binary("run0") else ["sudo"]
+    return ["run0"] if find_binary("run0") and Path("/run/systemd/system").exists() else ["sudo"]