[systemd-devel] systemctl is-enabled...

Lennart Poettering lennart at poettering.net
Wed Mar 16 18:03:37 PDT 2011


On Tue, 08.03.11 21:23, Andrey Borzenkov (arvidjaar at mail.ru) wrote:

> 
> On Mon, Mar 7, 2011 at 4:00 AM, Lennart Poettering
> <lennart at poettering.net> wrote:
> > What about this solution consisting of these 4 rules together:
> >
> > 1. A service residing in /lib with no [Install] section will
> >   unconditionally be considered enabled.
> > 2. A service which has at least one symlink to it in /etc is considered
> >   enabled.
> > 3. Symlinks in /lib are irrelevant
> > 4. We'd not recursively traverse tree
> >
> > That way dbus would always appear enabled due to rule #1.
> >
> 
> What to do with aliases?
> 
> [root at localhost ~]# systemctl -p Names -p Id --no-pager show dm.service
> Id=prefdm.service
> Names=display-manager.service prefdm.service dm.service
> [root at localhost ~]# systemctl is-enabled dm.service
> dm.service is not a native service, redirecting to /sbin/chkconfig.
> Executing /sbin/chkconfig dm
> [root at localhost ~]# echo $?
> 1
> 
> Well ...
> 
> dm.service is obviously enabled; even if it is enabled under different
> alias

Hmm, I guess that's a reason why Names= are a bad idea to use. People
should place proper symlinks if they want to establish additional names.

If people use symlink aliases, then we can use them to find the
files. If people use Names= then we can use them only in systemd itself
and only if the service has been loaded.

TBH, i am tempted to remove Names= entirely from systemd, as I fail to
see a non-confusing really good usecase for this right now.

> BTW /etc/init.d/dm actually is enabled ... just in different run
> level.

We invoke "chkconfig --level=3" right now. Given that 5 is usually a
superset of 1,2,3,4 using 5 here is probably a safer choice if we need
to make one. /me changes that.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list