[systemd-devel] [RFC PATCH] condition: add ConditionFileContains=

Łukasz Stelmach l.stelmach at samsung.com
Fri Jul 12 01:05:36 PDT 2013

It was <2013-07-12 pią 04:48>, when Kyungmin Park wrote:
> On Fri, Jul 12, 2013 at 7:43 AM, Lennart Poettering
> <lennart at poettering.net> wrote:
>> On Thu, 11.07.13 13:37, Dave Reisner (d at falconindy.com) wrote:
>>> > +        p = strchr(path, ':');
>>> This is going to fail for a file:value pair such as /foo:/bar/baz:value.
>>> You could use strrchr(), but then you have to be concerned about
>>> matching values with a colon.
>> This might become a problem, but then again, I think it is OK if some
>> files cannot be checked with this. I'd prefer using a space or "=" as
>> separator as a better choice though, as that's probably less frequent
>> than ":" in the names of files one would check with this condition
>> setting.
>> Lennart
> It's another question.
> the main goal of this patch is that supports conditional execution
> If some services are executed with given condition, it should check
> some conditions and execute different flow.
> if [ condition is 1 ]; then
>     launch A service
> else if [ condition is 2 ]; then
>     launch B service
> else
>     launch C service

IMHO this looks too complicated to fit into systemd units. To support
such (multiple choice) situation (which seems like the the conditions
are not properly stated) we can use a generator to link the desired
service to the proper target.

Łukasz Stelmach
Samsung R&D Institute Poland
Samsung Electronics

More information about the systemd-devel mailing list