]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
examples: fix unset OPTIONS variable warning in systemd services
authorAndreas Fenkart <extern-afe@mission-embedded.com>
Mon, 12 May 2025 08:32:57 +0000 (10:32 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Mon, 12 May 2025 09:31:42 +0000 (11:31 +0200)
Modify chronyd.service to handle cases where OPTIONS is undefined,
which occurs when /etc/sysconfig/chronyd doesn't exist or doesn't set
the variable. This prevents the warning:

 "chronyd.service: Referenced but unset environment variable
  evaluates to an empty string: OPTIONS"

examples/chronyd-restricted.service
examples/chronyd.service

index 18946210c7bf43cc2ed419b7bae321cf0f51aa4f..48f9a0650f7fd1c0786b320d3ffbad2d5e24a968 100644 (file)
@@ -14,6 +14,7 @@ ConditionCapability=CAP_SYS_TIME
 [Service]
 Type=notify
 PIDFile=/run/chrony/chronyd.pid
+Environment="OPTIONS="
 EnvironmentFile=-/etc/sysconfig/chronyd
 ExecStart=/usr/sbin/chronyd -n -U $OPTIONS
 
index e322454371644789733c62ba9b47a65c216dc24e..b6b17426ec9792e26844b9f51361346a472b9a7f 100644 (file)
@@ -8,6 +8,7 @@ ConditionCapability=CAP_SYS_TIME
 [Service]
 Type=notify
 PIDFile=/run/chrony/chronyd.pid
+Environment="OPTIONS="
 EnvironmentFile=-/etc/sysconfig/chronyd
 ExecStart=/usr/sbin/chronyd -n $OPTIONS