From 6061c86693453162395c46eda5e6fac34dea8985 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 26 Aug 2022 17:20:56 +0200 Subject: compare: add two new operators "==" and "<>" These two operators always indicate ordering comparisons, as opposed to "=" and "!=" which depending on context mean literal string compares. This is useful for ConditionOSRelease= for example, as this means there's now always a way to do version compares. --- man/systemd.unit.xml | 62 ++++++++++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 29 deletions(-) (limited to 'man/systemd.unit.xml') diff --git a/man/systemd.unit.xml b/man/systemd.unit.xml index 78a8db2e60..c5ba817579 100644 --- a/man/systemd.unit.xml +++ b/man/systemd.unit.xml @@ -1244,15 +1244,17 @@ device-tree-compatible(value) for systems with a device tree that is compatible to value. - smbios-field(field operator value) - for systems with a SMBIOS field containing a certain value. - field is the name of the SMBIOS field exposed as sysfs attribute file - below /sys/class/dmi/id/. + smbios-field(field operator + value) for systems with a SMBIOS field containing a certain + value. field is the name of the SMBIOS field exposed as + sysfs attribute file below /sys/class/dmi/id/. operator is one of <, <=, - >=, >, =, != for version - comparison, or =$, !=$ for string comparison. - value is the expected value of the SMBIOS field (shell-style globs are possible if - =$ or!=$ is used). + >=, >, ==, + <> for version comparison, = and != + for literal string comparison, or =$, !=$ for shell-style + glob comparison. value is the expected value of the SMBIOS field value + (possibly containing shell style globs in case =$/!=$ is + used). @@ -1333,9 +1335,10 @@ version (as reported by uname -r) 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. For each of the expressions, if it starts with one of <, - <=, =, !=, >=, - > a relative version comparison is done, otherwise the specified string is - matched with shell-style globs. + <=, = (or ==), != + (or <>), >=, > a relative + version comparison is done, otherwise the specified string is matched with shell-style + globs. 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 @@ -1605,10 +1608,11 @@ Verify that the specified amount of system memory is available to the current system. Takes a memory size in bytes as argument, optionally prefixed with a comparison operator - <, <=, =, !=, - >=, >. On bare-metal systems compares the amount of - physical memory in the system with the specified size, adhering to the specified comparison - operator. In containers compares the amount of memory assigned to the container instead. + <, <=, = (or ==), + != (or <>), >=, + >. On bare-metal systems compares the amount of physical memory in the system + with the specified size, adhering to the specified comparison operator. In containers compares the + amount of memory assigned to the container instead. @@ -1617,13 +1621,14 @@ Verify that the specified number of CPUs is available to the current system. Takes a number of CPUs as argument, optionally prefixed with a comparison operator - <, <=, =, !=, - >=, >. Compares the number of CPUs in the CPU affinity - mask configured of the service manager itself with the specified number, adhering to the specified - comparison operator. On physical systems the number of CPUs in the affinity mask of the service - manager usually matches the number of physical CPUs, but in special and virtual environments might - differ. In particular, in containers the affinity mask usually matches the number of CPUs assigned - to the container and not the physically available ones. + <, <=, = (or ==), + != (or <>), >=, + >. Compares the number of CPUs in the CPU affinity mask configured of the + service manager itself with the specified number, adhering to the specified comparison operator. On + physical systems the number of CPUs in the affinity mask of the service manager usually matches the + number of physical CPUs, but in special and virtual environments might differ. In particular, in + containers the affinity mask usually matches the number of CPUs assigned to the container and not + the physically available ones. @@ -1694,13 +1699,12 @@ Verify that a specific key=value pair is set in the host's os-release5. - Other than exact string matching with =, and !=, - relative comparisons are supported for versioned parameters (e.g. VERSION_ID), - and shell-style wildcard comparisons (*, ?, - []) are supported with the =$ (match) and - !=$ (non-match). The comparator can be one of <, - <=, =, !=, >=, - >, =$ and !=$. + Other than exact string matching (with = and !=), + relative comparisons are supported for versioned parameters (e.g. VERSION_ID; + with <, <=, ==, + <>, >=, >), and shell-style + wildcard comparisons (*, ?, []) are + supported with the =$ (match) and !=$ (non-match). -- cgit v1.2.1