mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-03-08 20:58:20 +03:00
condition: for completenes sake at != comparator for ConditionKernelVersion=
This commit is contained in:
parent
78d7652549
commit
2877d42870
@ -1117,11 +1117,12 @@
|
||||
the exact assignment is looked for with right and left hand
|
||||
side matching.</para>
|
||||
|
||||
<para><varname>ConditionKernelVersion=</varname> may be used to check whether the kernel version (as reported
|
||||
by <command>uname -r</command>) matches a certain expression (or if prefixed with the exclamation mark does not
|
||||
match it). The argument must be a single string. If the string starts with one of <literal><</literal>,
|
||||
<literal><=</literal>, <literal>=</literal>, <literal>>=</literal>, <literal>></literal> a relative
|
||||
version comparison is done, otherwise the specified string is matched with shell-style globs.</para>
|
||||
<para><varname>ConditionKernelVersion=</varname> may be used to check whether the kernel version (as
|
||||
reported by <command>uname -r</command>) matches a certain expression (or if prefixed with the
|
||||
exclamation mark does not match it). The argument must be a single string. If the string starts with
|
||||
one of <literal><</literal>, <literal><=</literal>, <literal>=</literal>,
|
||||
<literal>!=</literal>, <literal>>=</literal>, <literal>></literal> a relative version
|
||||
comparison is done, otherwise the specified string is matched with shell-style globs.</para>
|
||||
|
||||
<para>Note that using the kernel version string is an unreliable way to determine which features are supported
|
||||
by a kernel, because of the widespread practice of backporting drivers, features, and fixes from newer upstream
|
||||
|
@ -138,6 +138,7 @@ typedef enum {
|
||||
ORDER_LOWER,
|
||||
ORDER_GREATER,
|
||||
ORDER_EQUAL,
|
||||
ORDER_UNEQUAL,
|
||||
_ORDER_MAX,
|
||||
_ORDER_INVALID = -1
|
||||
} OrderOperator;
|
||||
@ -150,6 +151,7 @@ static OrderOperator parse_order(const char **s) {
|
||||
[ORDER_LOWER] = "<",
|
||||
[ORDER_GREATER] = ">",
|
||||
[ORDER_EQUAL] = "=",
|
||||
[ORDER_UNEQUAL] = "!=",
|
||||
};
|
||||
|
||||
OrderOperator i;
|
||||
@ -180,6 +182,9 @@ static bool test_order(int k, OrderOperator p) {
|
||||
case ORDER_EQUAL:
|
||||
return k == 0;
|
||||
|
||||
case ORDER_UNEQUAL:
|
||||
return k != 0;
|
||||
|
||||
case ORDER_GREATER_OR_EQUAL:
|
||||
return k >= 0;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user