mirror of
https://github.com/systemd/systemd.git
synced 2026-01-25 00:33:29 +03:00
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.
33 lines
991 B
Desktop File
33 lines
991 B
Desktop File
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
[Unit]
|
|
Description=Test for basic execution
|
|
ConditionKernelVersion=">=3.0"
|
|
ConditionKernelVersion=">=2.0" "<=60" "!=1.4"
|
|
ConditionKernelVersion=" >= 2.0" " <= 60 " "!= 1.4"
|
|
ConditionKernelVersion=" >= 2.0" " * " "*.*"
|
|
|
|
ConditionVersion=kernel ">=3.0"
|
|
ConditionVersion=kernel ">=2.0" "<=60" "!=1.4"
|
|
ConditionVersion=kernel " >= 2.0" " <= 60 " "!= 1.4"
|
|
ConditionVersion=kernel " >= 2.0" " * " "*.*"
|
|
|
|
ConditionVersion=">=3.0"
|
|
ConditionVersion=">=2.0" "<=60" "!=1.4"
|
|
ConditionVersion=" >= 2.0" " <= 60 " "!= 1.4"
|
|
ConditionVersion=" >= 2.0" " * " "*.*"
|
|
|
|
ConditionVersion=systemd ">=30"
|
|
ConditionVersion=systemd ">=20" "<=9000" "!=14"
|
|
ConditionVersion=systemd " >= 20" " <= 9000 " "!= 14"
|
|
ConditionVersion=systemd " >= 20" " * "
|
|
|
|
[Service]
|
|
ExecStart=touch /tmp/a ; /bin/sh -c 'touch /tmp/b' ; touch /tmp/c
|
|
ExecStart=test -f /tmp/a
|
|
ExecStart=!test -f /tmp/b
|
|
ExecStart=!!test -f /tmp/c
|
|
ExecStartPost=rm /tmp/a /tmp/b /tmp/c
|
|
|
|
PrivateTmp=true
|
|
Type=oneshot
|