From e495dd05e5c938008e9a1126985710b8e22d9ea6 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Wed, 8 Jun 2011 14:45:24 +0200 Subject: add abrt-oops systemd service (trac#287) --- abrt.spec.in | 18 +++++++++++++++--- src/plugins/Makefile.am | 5 +++++ src/plugins/abrt-oops.service | 9 +++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 src/plugins/abrt-oops.service diff --git a/abrt.spec.in b/abrt.spec.in index 1808fa64..8b622429 100644 --- a/abrt.spec.in +++ b/abrt.spec.in @@ -281,7 +281,13 @@ fi if [ $1 -eq 1 ]; then /sbin/chkconfig --add abrt-oops fi -#systemd: TODO +#systemd +%if %{?with_systemd} +if [ $1 -eq 1 ]; then + # Enable (but don't start) the units by default + /bin/systemctl enable abrt-oops.service >/dev/null 2>&1 || : +fi +%endif %preun if [ "$1" -eq "0" ] ; then @@ -314,8 +320,8 @@ if [ "$1" -eq "0" ] ; then service abrt-oops stop >/dev/null 2>&1 /sbin/chkconfig --del abrt-oops fi -#systemd (not tested): -%if 0 +#systemd +%if %{?with_systemd} if [ "$1" -eq "0" ] ; then /bin/systemctl --no-reload abrt-oops.service >/dev/null 2>&1 || : /bin/systemctl stop abrt-oops.service >/dev/null 2>&1 || : @@ -326,6 +332,9 @@ fi %postun /bin/systemctl daemon-reload >/dev/null 2>&1 || : +%postun addon-kerneloops +/bin/systemctl daemon-reload >/dev/null 2>&1 || : + %endif %post gui @@ -447,6 +456,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %config(noreplace) %{_sysconfdir}/%{name}/plugins/Kerneloops.conf %{_sysconfdir}/%{name}/events/report_Kerneloops.xml %config(noreplace) %{_sysconfdir}/%{name}/events.d/koops_events.conf +%if %{?with_systemd} +/lib/systemd/system/abrt-oops.service +%endif %{_initrddir}/abrt-oops %{_mandir}/man*/abrt-action-kerneloops.* %{_bindir}/abrt-dump-oops diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am index b041b060..a8d0f989 100644 --- a/src/plugins/Makefile.am +++ b/src/plugins/Makefile.am @@ -409,3 +409,8 @@ abrt_retrace_client_SOURCES = \ $(NSS_LIBS) DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ + +if HAVE_SYSTEMD +dist_systemdsystemunit_DATA = \ + abrt-oops.service +endif diff --git a/src/plugins/abrt-oops.service b/src/plugins/abrt-oops.service new file mode 100644 index 00000000..4911e2ba --- /dev/null +++ b/src/plugins/abrt-oops.service @@ -0,0 +1,9 @@ +[Unit] +Description=ABRT kernel log watcher +After=syslog.target + +[Service] +ExecStart=/usr/bin/abrt-dump-oops -d /var/spool/abrt -rwx /var/log/messages + +[Install] +WantedBy=multi-user.target -- cgit