From: Daan De Meyer Date: Sat, 6 May 2023 09:54:15 +0000 (+0200) Subject: Write all systemd units and dropins to /usr/ instead of /etc X-Git-Tag: v15~177^2~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5a7772162caad72a12cc9a6a42a1387e69ba91c;p=thirdparty%2Fmkosi.git Write all systemd units and dropins to /usr/ instead of /etc We want to accomodate images that only ship a /usr partition so let's start by writing all of our dropins and units to /usr. --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index a985153ab..74b643f1d 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -1332,7 +1332,7 @@ def configure_ssh(state: MkosiState) -> None: if not state.config.ssh: return - state.root.joinpath("etc/systemd/system/ssh.socket").write_text( + state.root.joinpath("usr/lib/systemd/system/ssh.socket").write_text( dedent( """\ [Unit] @@ -1350,7 +1350,7 @@ def configure_ssh(state: MkosiState) -> None: ) ) - state.root.joinpath("etc/systemd/system/ssh@.service").write_text( + state.root.joinpath("usr/lib/systemd/system/ssh@.service").write_text( dedent( """\ [Unit] @@ -1370,8 +1370,7 @@ def configure_ssh(state: MkosiState) -> None: ) ) - presetdir = state.root / "etc/systemd/system-preset" - presetdir.mkdir(exist_ok=True, mode=0o755) + presetdir = state.root / "usr/lib/systemd/system-preset" presetdir.joinpath("80-mkosi-ssh.preset").write_text("enable ssh.socket\n") diff --git a/mkosi/install.py b/mkosi/install.py index 11d128a68..c3187d137 100644 --- a/mkosi/install.py +++ b/mkosi/install.py @@ -31,7 +31,7 @@ def write_resource( def add_dropin_config_from_resource( root: Path, unit: str, name: str, resource: str, key: str ) -> None: - dropin = root / f"etc/systemd/system/{unit}.d/{name}.conf" + dropin = root / f"usr/lib/systemd/system/{unit}.d/{name}.conf" dropin.parent.mkdir(mode=0o755, parents=True, exist_ok=True) write_resource(dropin, resource, key, mode=0o644)