]> git.ipfire.org Git - thirdparty/systemd.git/commit
condition: introduce ConditionVersion=/AssertVersion= 36468/head
authorMatteo Croce <teknoraver@meta.com>
Thu, 20 Feb 2025 12:07:24 +0000 (13:07 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 18 Mar 2025 09:36:59 +0000 (18:36 +0900)
commitc154bb65ad55a98fdf7d05fcb6b68a22408ea33a
tree9bf96fd303e66fd4a78271a894dafabeb268a534
parentf91273f4fc80e2f44910a179b5055603deca9500
condition: introduce ConditionVersion=/AssertVersion=

Add a new condition wich checks against systemd version.
Change condition_test_kernel_version() into a generic condition_test_version()
so most of the code can be reused.

    $ systemctl --version
    systemd 258 (258~devel-g53ca5f6)

    $ systemd-analyze condition 'ConditionVersion=systemd>255'
    test.service: ConditionVersion=>255 succeeded.

    $ systemd-analyze condition 'ConditionVersion=systemd>260'
    test.service: ConditionVersion=>260 failed.

    $ systemd-analyze condition 'ConditionVersion=systemd>=258'
    test.service: ConditionVersion=>=258 succeeded.

    $ systemd-analyze condition 'ConditionVersion=systemd>=257.1'
    test.service: ConditionVersion=>=257.1 succeeded.

    $ uname -r
    6.12.13-200.fc41.aarch64

    $ systemd-analyze condition 'ConditionVersion=kernel > 4.4'
    test.service: ConditionVersion=kernel > 4.4 succeeded.

    $ systemd-analyze condition 'ConditionVersion=kernel > 6.20'
    test.service: ConditionVersion=kernel > 6.20 failed.

    $ systemd-analyze condition 'ConditionVersion=kernel < 9.0'
    test.service: ConditionVersion=kernel < 9.0 succeeded.
14 files changed:
docs/TRANSIENT-SETTINGS.md
man/systemd-analyze.xml
man/systemd.link.xml
man/systemd.netdev.xml
man/systemd.network.xml
man/systemd.unit.xml
src/core/load-fragment-gperf.gperf.in
src/network/netdev/netdev-gperf.gperf
src/network/networkd-network-gperf.gperf
src/shared/condition.c
src/shared/condition.h
src/test/test-condition.c
src/udev/net/link-config-gperf.gperf
test/test-execute/exec-basic.service