Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add a wrapper script to be used in portduino when launching meshtasticd with systemd.
Rationale
Currently, to run multiple instances of meshtasticd you need to manually create multiple systemd unit files, one per instance. I would like to add support for Instantiated Services. Meshtasticd, however, is not yet able to leverage this due to various runtime-only options that are currently required in a multi-instance environment. These options are
--portand--fsdir.My currently open PR #8435 fixes one of these by adding support for an option
[General][APIPort]in the meshtasticd config. Unfortunately, fixing the second,--fsdirhas proven much more difficult due to how the option is used and that portion of the code not be aware of the meshtasticd config file. As a (temporary) solution to this issue that still provides support for instantiated services, I am proposing the use of a wrapper script to startup meshtasticd from systemd.when calling a service using the following convention, systemd passes the value between
@and.serviceto the unit file as an instance ID which can be referred to using%iand%Iwithin the unit file itself:By passing the instance ID to the wrapper script and establishing a standard format for configuration files and VFS paths, we can "fake" support for instantiated instances for now until a way forward with support for
--fsdirin the config file is found.Launching a meshtasticd daemon using the new script would utilize
/etc/meshtasticd/config.d/<instance>-config.yamland/var/lib/meshtasticd-<instance>for the config and vfs respectively.