diff --git a/SOURCES/98-trace-cmd.rules b/SOURCES/98-trace-cmd.rules new file mode 100644 index 0000000..9575bd8 --- /dev/null +++ b/SOURCES/98-trace-cmd.rules @@ -0,0 +1 @@ +SUBSYSTEM=="module", ACTION=="add", PROGRAM="/usr/bin/systemctl is-active trace-cmd.service", PROGRAM="/usr/bin/systemctl reload trace-cmd.service" diff --git a/SOURCES/trace-cmd.conf b/SOURCES/trace-cmd.conf new file mode 100644 index 0000000..85c4fbe --- /dev/null +++ b/SOURCES/trace-cmd.conf @@ -0,0 +1,4 @@ +# ftrace based flightrecorder configuration file. + +# trace-cmd options +OPTS="-b 2048 -i -e block -e irq -e mce -e module -e power -e sched -e signal -e timer -e workqueue -e kvm -e net" diff --git a/SOURCES/trace-cmd.service b/SOURCES/trace-cmd.service new file mode 100644 index 0000000..27b07f5 --- /dev/null +++ b/SOURCES/trace-cmd.service @@ -0,0 +1,15 @@ +[Unit] +Description=trace-cmd Flightrecorder +DefaultDependencies=no +Before=sysinit.target + +[Service] +Type=oneshot +RemainAfterExit=yes +EnvironmentFile=/etc/sysconfig/trace-cmd.conf +ExecStart=/usr/bin/trace-cmd start $OPTS +ExecStop=/usr/bin/trace-cmd reset +ExecReload=/usr/bin/trace-cmd start $OPTS + +[Install] +WantedBy=multi-user.target diff --git a/SPECS/trace-cmd.spec b/SPECS/trace-cmd.spec index 9dd4496..9d29f13 100644 --- a/SPECS/trace-cmd.spec +++ b/SPECS/trace-cmd.spec @@ -6,7 +6,7 @@ Name: trace-cmd Version: %{srcversion} -Release: 8%{?dist} +Release: 9%{?dist} License: GPLv2 and LGPLv2 Summary: A user interface to Ftrace Requires: libtracecmd @@ -19,6 +19,9 @@ URL: http://git.kernel.org/?p=linux/kernel/git/rostedt/trace-cmd.git;a=summary # cd trace-cmd # git archive --prefix=trace-cmd-%%{version}/ -o trace-cmd-v%%{version}.tar.gz %%{git_commit} Source0: https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/snapshot/trace-cmd-v%{srcversion}.tar.gz +Source1: trace-cmd.conf +Source2: trace-cmd.service +Source3: 98-trace-cmd.rules Patch0: trace-cmd-Fix-broken-profile-command.patch Patch1: trace-cmd-utils.mk-don-t-ignore-LDFLAGS-when-linking-the-share.patch @@ -38,6 +41,7 @@ BuildRequires: json-c-devel BuildRequires: libtraceevent-devel BuildRequires: libtracefs-devel BuildRequires: chrpath +BuildRequires: systemd-rpm-macros %description trace-cmd is a user interface to Ftrace. Instead of needing to use the @@ -70,6 +74,9 @@ Development files of the libtracecmd library %prep %autosetup -p1 -n %{name}-v%{srcversion} +cp %{SOURCE1} . +cp %{SOURCE2} . +cp %{SOURCE3} . %build %set_build_flags @@ -92,7 +99,15 @@ make V=1 libdir=%{_libdir} prefix=%{_prefix} DESTDIR=%{buildroot}/ \ find %{buildroot}%{_mandir} -type f | xargs chmod u-x,g-x,o-x find %{buildroot}%{_datadir} -type f | xargs chmod u-x,g-x,o-x find %{buildroot}%{_libdir} -type f -iname "*.so" | xargs chmod 0755 -mkdir -p %{buildroot}/%{_sysconfdir} +mkdir -p -m755 %{buildroot}/%{_sysconfdir}/sysconfig/ +mkdir -p -m755 %{buildroot}/%{_unitdir}/ +mkdir -p -m755 %{buildroot}/%{_udevrulesdir}/ +install -p -m 644 trace-cmd.conf %{buildroot}/%{_sysconfdir}/sysconfig/ +install -p -m 644 trace-cmd.service %{buildroot}/%{_unitdir}/ +install -p -m 644 98-trace-cmd.rules %{buildroot}/%{_udevrulesdir}/ + +%preun +%systemd_preun %{name}.service %files %doc COPYING COPYING.LIB README @@ -100,6 +115,9 @@ mkdir -p %{buildroot}/%{_sysconfdir} %{_mandir}/man1/%{name}* %{_mandir}/man5/%{name}* %{_sysconfdir}/bash_completion.d/trace-cmd.bash +%{_sysconfdir}/sysconfig/trace-cmd.conf +%{_unitdir}/trace-cmd.service +%{_udevrulesdir}/98-trace-cmd.rules %files python3 %doc Documentation/README.PythonPlugin @@ -119,6 +137,9 @@ mkdir -p %{buildroot}/%{_sysconfdir} %{_includedir}/trace-cmd %changelog +* Thu Mar 31 2022 Jerome Marchand - 2.9.2-9 +- Add flight recorder service + * Fri Nov 12 2021 Jerome Marchand - 2.9.2-8 - Fix remaining gating runpath failure