From 901fa249058fd5adf71f108cf5ddfa05f8681d81 Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Mon, 22 Apr 2024 21:35:23 +0200 Subject: [PATCH] stages/systemd: add -- before unit names Units can start with a -, for example, -.mount. Trying to enable, disable, or mask a service like that fails with systemctl: invalid option -- '.' Hint: to specify units starting with a dash, use "--": systemctl [OPTIONS...] COMMAND -- -.mount ... Adding -- to all 'systemctl' calls lets us specify unit files that start with -. --- stages/org.osbuild.systemd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stages/org.osbuild.systemd b/stages/org.osbuild.systemd index 21c86962..7f1c0798 100755 --- a/stages/org.osbuild.systemd +++ b/stages/org.osbuild.systemd @@ -14,13 +14,13 @@ def main(tree, options): default_target = options.get("default_target") for service in enabled_services: - subprocess.run(["systemctl", "--root", tree, "enable", service], check=True) + subprocess.run(["systemctl", "--root", tree, "enable", "--", service], check=True) for service in disabled_services: - subprocess.run(["systemctl", "--root", tree, "disable", service], check=True) + subprocess.run(["systemctl", "--root", tree, "disable", "--", service], check=True) for service in masked_services: - subprocess.run(["systemctl", "--root", tree, "mask", service], check=True) + subprocess.run(["systemctl", "--root", tree, "mask", "--", service], check=True) if masked_generators: # systemctl can't mask generators, so manually create the mask