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.
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]
)
)
- state.root.joinpath("etc/systemd/system/ssh@.service").write_text(
+ state.root.joinpath("usr/lib/systemd/system/ssh@.service").write_text(
dedent(
"""\
[Unit]
)
)
- 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")
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)