[systemd-devel] Virtual dependencies
Lennart Poettering
lennart at poettering.net
Tue Aug 21 15:06:57 PDT 2012
On Tue, 21.08.12 14:31, David.Yates at continental-corporation.com (David.Yates at continental-corporation.com) wrote:
> Hi All,
>
> I am hoping someone can help me with a dependency problem that I am
> currently having and I assume there is already a simple solution available
> that I am missing.
>
> I was looking for some handling inside of systemd that would work similar
> to the concept of virtual packages in the Debian package management
> situation.
>
> Whereby, if I install an application that requires a mail transport agent
> then that application can be set as dependent on a virtual class of
> service that can be fulfilled by one of many applications that can be
> installed.
>
> This would be something like a "Provides" tag in the unit file. I have
> seen the Alias tag and assume that that could be used in a similar way but
> I am not sure what happens if you have multiple applications that alias to
> the same virtual name. This would need some way to tell systemd which app
> is actually the currently selected app for that virtual class.
>
> The goal of this all being obviously to be able to handle runtime
> dependencies and automatically starting the required underlying services
> when needed.
>
> Thanks for any help and sorry if I have missed a really easy way that this
> should be handled.
The way we currently handle this mostly is indeed by using Alias=. For
example the various implementations of a Display Manager all have an
Alias=display-manager.service, and that link then decides which
implementation is pulled in.
"systemctl enable" will fail if a symlink it is supposed to create
already exists. (This can be override with --force, which results in the
symlink being replaced).
This is suboptimal for other use cases though I guess, we could add some
other logic there to make it unnecessary to always maintain a symlink
for this in FS. I am open to ideas there, but the Alias= solution
definitely is something that works right now for many uses.
Lennart
--
Lennart Poettering - Red Hat, Inc.
More information about the systemd-devel
mailing list