|
14 | 14 | %global numcomm @numcomm@ |
15 | 15 | %global dirty @dirty@ |
16 | 16 |
|
| 17 | +# Whether this platform defaults to using systemd as an init system |
| 18 | +# (needs to be evaluated prior to BuildRequires being enumerated and |
| 19 | +# installed as it's intended to conditionally select some of these, and |
| 20 | +# for that there are only few indicators with varying reliability: |
| 21 | +# - presence of systemd-defined macros (when building in a full-fledged |
| 22 | +# environment, which is not the case with ordinary mock-based builds) |
| 23 | +# - systemd-aware rpm as manifested with the presence of particular |
| 24 | +# macro (rpm itself will trivially always be present when building) |
| 25 | +# - existence of /usr/lib/os-release file, which is something heavily |
| 26 | +# propagated by systemd project |
| 27 | +# - when not good enough, there's always a possibility to check |
| 28 | +# particular distro-specific macros (incl. version comparison) |
| 29 | +%define systemd_native (%{?_unitdir:1}%{!?_unitdir:0}%{nil \ |
| 30 | + } || %{?__transaction_systemd_inhibit:1}%{!?__transaction_systemd_inhibit:0}%{nil \ |
| 31 | + } || %(test -f /usr/lib/os-release; test $? -ne 0; echo $?)) |
| 32 | + |
17 | 33 | # |
18 | 34 | # Since this spec file supports multiple distributions, ensure we |
19 | 35 | # use the correct group for each. |
@@ -162,10 +178,10 @@ Requires: perl-Net-IMAP-Simple-SSL |
162 | 178 | Requires(post): /sbin/chkconfig |
163 | 179 | Requires(preun):/sbin/chkconfig |
164 | 180 | %endif |
165 | | -%if %{defined systemd_requires} |
| 181 | +%if %{systemd_native} |
166 | 182 | BuildRequires: systemd |
167 | | -%{?systemd_requires} |
168 | 183 | %endif |
| 184 | +%{?systemd_requires} |
169 | 185 |
|
170 | 186 | %description -n ldirectord |
171 | 187 | The Linux Director Daemon (ldirectord) was written by Jacob Rief. |
|
0 commit comments