Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for dynamic multiplexing of services #753

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

navi-desu
Copy link
Member

generate a new directory on the service dir, "multiplexed", which will
hold all the symlinks we generate at runtime, and a new librc function,
"rc_service_multiplex", which takes a basename or service path, and a
variant name, then generated a symlink to the base service from the
multiplex dir.

this allows multiplexing services at runtime, possibly using data
acquired at runtime, such as the name of an user or interface.

this is the second of three patchsets for user services support

as an initial barebones implementation, it's useful only for generating
services without dynamically multiplexed dependencies, as this is what's
needed for bootstrapping the openrc user script in a new session.

a future patch may improve on it, possibly integrating it in dependency
resolution and on the rc-service tool.

Use the realpath of the target to locate which system directory it's
in, using it as a base to load the config file. the service path is then
normalized from the symlink without dereferencing it.

Introduce a new variable for openrc-run, $RC_SYSCONFDIR, which points to
the respective system directory of the base service.

Signed-off-by: Anna (navi) Figueiredo Gomes <[email protected]>
Generate a new directory on the service dir, "multiplexed", which will
hold all the symlinks we generate at runtime, and a new librc function,
"rc_service_multiplex", which takes a basename or service path, and a
variant name, then generated a symlink to the base service from the
multiplex dir.

This allows multiplexing services at runtime, possibly using data
acquired at runtime, such as the name of an user or interface.
@navi-desu
Copy link
Member Author

currently working on how to make sure multiplexed services get added to the deptree properly

probably gonna split the deptree generating function so we can also call it per-service

@WhyNotHugo
Copy link

Should the documentation also explain what "multiplexed services" are?
It's not very clear from the current documentation, and this seems to be a new concept.

@navi-desu
Copy link
Member Author

navi-desu commented Oct 27, 2024

Should the documentation also explain what "multiplexed services" are? It's not very clear from the current documentation, and this seems to be a new concept.

openrc-run(8) kinda just mentions it, it's not new

it's basically when you have a . in the name of the service, so, when starting net.eth0, the following configs are attempted to be loaded, in order: rc.conf, conf.d/net, conf.d/net.eth0

it is usually done as a symlink, e.g. wg-quick.vpn1 -> wg-quick, net.eth0 -> net.lo, but doesn't have to be, openrc-run only checks the service name to find multiplexed configs

yeah the docs need improving

and doing this dynamically, would be creating that symlink as needed. so say some service does depend { need foo.nya }, and /etc/init.d/foo.nya does not exit, but /etc/init.d/foo does, openrc would then symlink foo to /run/openrc/multiplexed/foo.nya, and start that

current major use case for this would be instantiating user.<username> automatically for user services

though this feature is currently being debated if we include it at all or not, as i'm not sure it's useful at all outside user services

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants