]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Make sure policy-rc.d parent directory exists
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 2 Jul 2024 09:09:29 +0000 (11:09 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 2 Jul 2024 10:26:27 +0000 (12:26 +0200)
If BaseTrees= is used /usr/sbin might not exist so let's make sure
it does to avoid failing with an incomprehensible exception.

mkosi/distributions/debian.py

index e55906ca2b1c6a08cbe6e04ac5db3d20cf986ab7..b7649c08f04d7ed67a41a1d790cc08d3a29ca045 100644 (file)
@@ -196,6 +196,8 @@ class Installer(DistributionInstaller):
         # Note: despite writing in /usr/sbin, this file is not shipped by the OS and instead should be managed by
         # the admin.
         policyrcd = context.root / "usr/sbin/policy-rc.d"
+        with umask(~0o755):
+            policyrcd.parent.mkdir(parents=True, exist_ok=True)
         with umask(~0o644):
             policyrcd.write_text("#!/bin/sh\nexit 101\n")