Systemd unit file implementation questions (ypbind)

Lennart Poettering mzerqung at 0pointer.de
Thu Apr 14 22:23:55 UTC 2011


On Thu, 14.04.11 20:35, Miloslav Trmač (mitr at volny.cz) wrote:

> 
> On Thu, Apr 14, 2011 at 8:21 PM, Lennart Poettering
> <mzerqung at 0pointer.de> wrote:
> > On Thu, 14.04.11 13:05, Chris Adams (cmadams at hiwaay.net) wrote:
> >> Since they are config files (unlike the init scripts themselves),
> >> changing them doesn't leave you with RPM wanting to replace them on
> >> every package update either.
> >
> > Yupp, and this is much much prettier in systemd. After you copied the
> > service file from /lib to /etc they are out of the package manager
> > territory and will always override what has been configured by the
> > distro packager.
> Separating the program that integrates software into the distribution
> (/etc/init.d/*) and user's configuration that is managed via
> .rpm{save,new} is actually valuable.
> 
> If upstream changes how the program should be invoked and the Fedora
> packager updates /etc/init.d/*, this change is transparent to users,
> as long as the chang doesn't affect the specifics of user's
> configuration in /etc/sysconfig - and even if it does, the user has
> .rpm{save,new} and can figure out what has happened.

Well, the simple fact is that systemd unit files aren't really
code. They are just config. So doing code updates on a sysv init script
does not really translate to systemd, because there is nothing to
update.

> Copying the service file from /lib to /etc seems to lose this property
> - if the /etc file "hides" the /lib file, the service will just break
> with no indication that something needs to be updated.  Or does
> systemd support "inheritance" of configuration from /lib to /etc so
> that the user can only make the minimal changes necessary?

Yes, you can use ".include /lib/systemd/system/foo.service" to import
another file, and then override selected settings.

Note however that while some settings override others some act as
additions. Example: A later User=foo will override an earlier User=bar,
but a later Requires=foo will be added to an earlier Requires=bar, so
that you effectively have "Requires=foo bar". But I think it's kinda
obvious in most cases which settings are those with work as an addition
and which ones override.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the devel mailing list