33%global zypper_install (0%{?suse_version } > 0)
44%global build_tracer 0%{?rhel } >= 7 || 0%{?fedora } || 0%{?suse_version }
55
6+ %if 0%{?suse_version }
7+ %global pkg_systemd_post() %service_add_post %{?*}
8+ %global pkg_systemd_preun() %service_del_preun %{?*}
9+ %global pkg_systemd_postun() %service_del_postun %{?*}
10+ %else
11+ %global pkg_systemd_post() %systemd_post %{?*}
12+ %global pkg_systemd_preun() %systemd_preun %{?*}
13+ %global pkg_systemd_postun() %systemd_postun %{?*}
14+ %endif
15+
616%if 0%{?suse_version }
717%define dist suse%{?suse_version }
818%endif
3343%global katello_libdir %{python_libdir }/katello
3444
3545Name: katello-host-tools
36- Version: 4.5 .0
37- Release: 2 %{?dist }
46+ Version: 4.6 .0
47+ Release: 1 %{?dist }
3848Summary: A set of commands and yum plugins that support a Katello host
3949Group: Development/Languages
4050%if 0%{?suse_version }
@@ -54,6 +64,8 @@ BuildArch: noarch
5464%endif
5565
5666Requires: subscription-manager
67+ Requires: systemd
68+ BuildRequires: systemd-rpm-macros systemd
5769Obsoletes: %{name }-fact-plugin < %{version }-%{release }
5870Obsoletes: katello-agent < %{version }-%{release }
5971
@@ -98,11 +110,6 @@ BuildArch: noarch
98110Summary: Adds Tracer functionality to a client managed by katello-host-tools
99111Group: Development/Languages
100112Requires: %{name } = %{version }-%{release }
101- %if 0%{?suse_version }
102- Requires: cronie
103- %else
104- Requires: crontabs
105- %endif
106113%if %{yum_install }
107114Requires: python2-tracer >= 0.6.12
108115%endif
@@ -208,9 +215,12 @@ mkdir -p %{buildroot}%{_sbindir}
208215cp extra/katello-tracer-upload-dnf %{buildroot }%{_sbindir }/katello-tracer-upload
209216%endif
210217
211- # crontab
212- mkdir -p %{buildroot }%{_sysconfdir }/cron.d/
213- cp extra/katello-tracer-upload.cron %{buildroot }%{_sysconfdir }/cron.d/katello-tracer-upload
218+ # tracer systemd service and timer
219+ install -Dp -m0644 extra/katello-tracer-upload.service.in %{buildroot }%{_unitdir }/katello-tracer-upload.service
220+ install -Dp -m0644 extra/katello-tracer-upload.timer %{buildroot }%{_unitdir }/katello-tracer-upload.timer
221+
222+ # replace @SBIN_PATH@ in the service file with the actual path to the executable
223+ sed -i "s|@SBIN_PATH@|%{_sbindir }|" %{buildroot }%{_unitdir }/katello-tracer-upload.service
214224%endif
215225
216226%clean
@@ -223,6 +233,23 @@ katello-enabled-repos-upload 2> /dev/null
223233exit 0
224234%endif
225235
236+ %post
237+ %pkg_systemd_post katello-tracer-upload.timer
238+
239+ if [ "$1" -eq 1 ]; then
240+ systemctl enable --now katello-tracer-upload.timer > /dev/null 2> &1 || :
241+ fi
242+
243+ %preun
244+ %pkg_systemd_preun katello-tracer-upload.timer
245+
246+ if [ "$1" -eq 0 ]; then
247+ systemctl disable --now katello-tracer-upload.timer > /dev/null 2> &1 || :
248+ fi
249+
250+ %postun
251+ %pkg_systemd_postun katello-tracer-upload.timer
252+
226253%files
227254%defattr(-,root,root,-)
228255%if 0%{?rhel } == 6
@@ -273,7 +300,6 @@ exit 0
273300%dir %{_usr }/lib/zypp
274301%dir %{_usr }/lib/zypp/plugins
275302%dir %{plugins_dir }
276- %dir %{_sysconfdir }/cron.d/
277303%{plugins_dir }/tracer_upload.py
278304%else
279305%if %{yum_install }
@@ -284,12 +310,17 @@ exit 0
284310%endif
285311%{katello_libdir }/tracer
286312%{plugins_confdir }/tracer_upload.conf
287- %config(noreplace) %attr(0644, root, root) %{_sysconfdir }/cron.d/katello-tracer-upload
313+ %{_unitdir }/katello-tracer-upload.service
314+ %{_unitdir }/katello-tracer-upload.timer
288315%attr(750, root, root) %{_sbindir }/katello-tracer-upload
289316%endif
290317
291318
292319%changelog
320+ * Tue Jun 09 2026 Bernhard Suttner <suttner@atix.de> - 4.6.0-1
321+ - Use systemd timer implementation instead of cron based
322+ solution for tracer upload
323+
293324* Wed Nov 05 2025 Bernhard Suttner <suttner@atix.de> - 4.5.0-2
294325- Fix missing /etc/cron.d/ dir for SLES / OBS build.
295326
0 commit comments