[systemd-devel] systemctl is-enabled...
lennart at poettering.net
Sun Mar 6 17:00:26 PST 2011
On Fri, 04.03.11 14:51, Bill Nottingham (notting at redhat.com) wrote:
> The implementation of the is-enabled command makes its not necessarily
> useful as I might expect it to be. From looking at it, it merely checks
> whether the '[Install]' section has been executed.
That is true.
> That means that it's not going to be correct for any service that has
> been enabled via other means, or doesn't have an '[Install]' section.
For the latter we generate a warning currently, telling the user that
the service has no [Install] section.
> Am I missing something? Is there a different command that should be used?
> It seems a more full implementation would parse the dependency graph for
> either the current or given target, and check that the service is wanted
> by some part of that.
Well, but what is the "current" target? We can have multiple.
And if you boot into single user mode, you probably are still interested
to know whether a service is enabled in multi-user.target when [Install]
Or to turn this around: I don't think "is-enabled" should have
different results when you run it from a different state of the system
or from a chroot or wherever.
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
3. Symlinks in /lib are irrelevant
4. We'd not recursively traverse tree
That way dbus would always appear enabled due to rule #1.
Does that make sense?
Lennart Poettering - Red Hat, Inc.
More information about the systemd-devel