mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-23 17:34:00 +03:00
condition: change ConditionKernelVersion= so that =/!= mean literal string comparison, and ==/<> version comparison
The only reason to do this is to ensure uniformity with the other options, that work like this, i.e. ConditionOSRelease= or ConditionSecurity=. This is a compatibility break, but a minor one, given that string comparison and version comparison is mostly the same for equality and inequality.
This commit is contained in:
parent
666d314a74
commit
06219747f5
@ -1334,9 +1334,9 @@
|
||||
<listitem><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 list of (potentially quoted)
|
||||
expressions. Each expression starts with one of <literal><</literal>, <literal><=</literal>,
|
||||
<literal>=</literal> (or <literal>==</literal>), <literal>!=</literal> (or
|
||||
<literal><></literal>), <literal>>=</literal>, <literal>></literal> for a relative
|
||||
expressions. Each expression starts with one of <literal>=</literal> or <literal>!=</literal> for
|
||||
string comparisons, <literal><</literal>, <literal><=</literal>, <literal>==</literal>,
|
||||
<literal><></literal>, <literal>>=</literal>, <literal>></literal> for a relative
|
||||
version comparison, or <literal>=$</literal>, <literal>!=$</literal> for a shell-style glob
|
||||
match. If no operator is specified <literal>=$</literal> is implied.</para>
|
||||
|
||||
|
@ -206,7 +206,7 @@ static int condition_test_kernel_version(Condition *c, char **env) {
|
||||
break;
|
||||
|
||||
s = strstrip(word);
|
||||
operator = parse_compare_operator(&s, COMPARE_ALLOW_FNMATCH);
|
||||
operator = parse_compare_operator(&s, COMPARE_ALLOW_FNMATCH|COMPARE_EQUAL_BY_STRING);
|
||||
if (operator < 0) /* No prefix? Then treat as glob string */
|
||||
operator = COMPARE_FNMATCH_EQUAL;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user