davmac314 / dinit

Service monitoring / "init" system
Apache License 2.0
620 stars 49 forks source link

Service file override #319

Closed phkrl closed 7 months ago

phkrl commented 7 months ago

Is your feature request related to a problem? Please describe. The idea is related to #258 and Artix thread https://forum.artixlinux.org/index.php/topic,6084.0.html In some cases it is possible that service file running in user system may require some differences compared to the service file for the same software provided by distro (examples from thread: dhcpcd, dhcpd, slapd, gitea). Writing custom file with different name can potentially break dependencies and require to create new files for other services dependent on the one which user originally needs to change (e.g. if i create file slapd-local the file for e.g. gitea should depend on it rather than on slapd). The required changes may be beyond just environment variables and script. The idea i propose is to add a concept of override files for services, similarly to how it is done in systemd.

Describe the solution you'd like This is how i see the solution: two keywords for service files are added. The first one is override which is a pattern to search for override files. If this keyword is present in service definition, dinit tries to find all files matching this pattern, sorts them (e.g. alphabetically), reads them and appends their contents to the original service file, thus overriding some properties or appending new ones (not sure if unsetting can be done in clear way). This override keyword is only read from the original service file and ignored for all the others. The override files could potentially contain condition keyword which tries some statement and if it evaluated to false, the override file is ignored. The second part, however, may be an overcomplication, since the desired result can be achieved without it.

davmac314 commented 7 months ago

There will be some improvement to user configurability of services. It's on my mind, but it needs careful thought. I'm not sure what form it will take.

As per the feature request template: We do not usually accept feature requests, please see the README. You may open a feature request if you are a distribution/package maintainer and have a clear need for the feature, or if you are willing to develop the feature yourself and would like to discuss it first. - can you please clarify which of those applies in this case?

phkrl commented 7 months ago

As per the feature request template: We do not usually accept feature requests, please see the README. You may open a feature request if you are a distribution/package maintainer and have a clear need for the feature, or if you are willing to develop the feature yourself and would like to discuss it first. - can you please clarify which of those applies in this case?

None, just sharing idea

davmac314 commented 7 months ago

Please respect the rules as laid out. You are free to open a discussion for other things.