condition: allow fnmatch compares for ConditionOSRelease=

We support this for smbios matches, hence do so for /etc/os-release
matches too.
This commit is contained in:
Lennart Poettering
2022-09-01 23:15:14 +02:00
parent 57610982f7
commit 8daa674090
3 changed files with 11 additions and 8 deletions
+2 -2
View File
@@ -1177,13 +1177,13 @@ TEST(condition_test_os_release) {
key_value_pair = strjoina(os_release_pairs[0], "=$", quote, os_release_pairs[1], quote);
condition = condition_new(CONDITION_OS_RELEASE, key_value_pair, false, false);
assert_se(condition);
assert_se(condition_test(condition, environ) == -EINVAL);
assert_se(condition_test(condition, environ) > 0);
condition_free(condition);
key_value_pair = strjoina(os_release_pairs[0], "!=$", quote, os_release_pairs[1], quote);
condition = condition_new(CONDITION_OS_RELEASE, key_value_pair, false, false);
assert_se(condition);
assert_se(condition_test(condition, environ) == -EINVAL);
assert_se(condition_test(condition, environ) == 0);
condition_free(condition);
/* Some distros (eg: Arch) do not set VERSION_ID */