Skip to content

Service generator #522

@xtexx

Description

@xtexx

Your background

Distribution maintainer and developer. If nobody takes over this, I am willing to contribute code (after I find enough spare time). Also cc. @ziyao233 who is willing to contribute.

The problem

Many services can be (and should be) generated on startup. These generators read configuration files in other formats and convert them to service files for dinit. For example, distributions may want to map entries in fstab to services; eweOS needs a getty service generator; I need a generator for Podman containers.

Most of these services could be written manually, but it will be a waste of time and will be (a bit) harder to read and write (a full service file with a command v.s. a line in fstab or a file defining podman container parameters).

The solution

Thus I propose adding service generators.

Upon startup, dinit runs all executables in a directory (maybe /usr/libexec/dinit-generators/ and ~/.local/bin/dinit-generators/?). Each executable writes some service files to a given output directory (I thought that outputting multiple services to stdout needs some way for splitting so I chose outputting to filesystem), then dinit loads these service files.

It will be better if there could be some sub-commands of dinitctl for reloading generators: dinitctl [options] reload-gen <generator-name>, dinitctl [options] unload-gen <generator-name>.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions