[systemd-devel] [RFC PATCH] condition: add ConditionFileContains=
k.lewandowsk at samsung.com
Fri Jul 12 11:42:31 PDT 2013
On 07/12/2013 03:40 PM, Kay Sievers wrote:
> On Fri, Jul 12, 2013 at 3:31 PM, Lennart Poettering
> <lennart at poettering.net> wrote:
>> To make this clear: I am not keen on adding this. I can see the
>> usefulness, and the thing is still simple enough so that it would be OK
>> to add this, but if you guys don't actually need that I'd prefer to keep
>> our codebase smaller...
We can workaround this one way or another - be it shell script,
udev rule or, in some cases, generator. Patch that started this
discussion is yet another option.
I have looked into /etc/init.d on my Debian system and found
following examples of 'grepping' files used to decide if given
service should be started or not:
- kernel option specified - /proc/cmdline
- filesystem available - /proc/filesystems
- file contains non commented out lines - /etc/exports
- cpu features available - /proc/cpuinfo
- software raid (md) status - /proc/mdstat
Every such case could be handled by generic "built-in grep"
instead of dozen of flags like ConditionCPUFeature=,
Having said that I fully understand that the line has to be
 Such condition should probably support globs so we would
end up with something like ConditionFileContentsGlob=
> Just a note:
> The above example should be triggered by a udev rule anyway.
More information about the systemd-devel