summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--abrt.spec.in18
-rw-r--r--src/hooks/Makefile.am5
-rw-r--r--src/hooks/abrt-ccpp.service11
3 files changed, 31 insertions, 3 deletions
diff --git a/abrt.spec.in b/abrt.spec.in
index 3d9dd0d0..c0e58f5e 100644
--- a/abrt.spec.in
+++ b/abrt.spec.in
@@ -275,7 +275,13 @@ chown -R abrt:abrt %{_localstatedir}/cache/abrt-di
if [ $1 -eq 1 ]; then
/sbin/chkconfig --add abrt-ccpp
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-ccpp.service >/dev/null 2>&1 || :
+fi
+%endif
%post addon-kerneloops
if [ $1 -eq 1 ]; then
@@ -307,8 +313,8 @@ if [ "$1" -eq "0" ] ; then
service abrt-ccpp stop >/dev/null 2>&1
/sbin/chkconfig --del abrt-ccpp
fi
-#systemd (not tested):
-%if 0
+#systemd
+%if %{?with_systemd}
if [ "$1" -eq "0" ] ; then
/bin/systemctl --no-reload disable abrt-ccpp.service >/dev/null 2>&1 || :
/bin/systemctl stop abrt-ccpp.service >/dev/null 2>&1 || :
@@ -335,6 +341,9 @@ fi
%postun addon-kerneloops
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+%postun addon-ccpp
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+
%endif
%post gui
@@ -432,6 +441,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/%{name}/plugins/CCpp.conf
%dir %attr(0775, abrt, abrt) %{_localstatedir}/cache/abrt-di
+%if %{?with_systemd}
+/lib/systemd/system/abrt-ccpp.service
+%endif
%{_initrddir}/abrt-ccpp
%{_libexecdir}/abrt-hook-ccpp
%{_bindir}/abrt-action-analyze-c
diff --git a/src/hooks/Makefile.am b/src/hooks/Makefile.am
index 49eddcf3..95cd3634 100644
--- a/src/hooks/Makefile.am
+++ b/src/hooks/Makefile.am
@@ -38,3 +38,8 @@ abrt_exception_handler.py:
# RPM fix: we need to regenerate abrt_exception_handler.py, because it has the default ddir
install-data-local:
sed s,\@VAR_RUN\@,\"$(VAR_RUN)\",g abrt_exception_handler.py.in > abrt_exception_handler.py
+
+if HAVE_SYSTEMD
+dist_systemdsystemunit_DATA = \
+ abrt-ccpp.service
+endif
diff --git a/src/hooks/abrt-ccpp.service b/src/hooks/abrt-ccpp.service
new file mode 100644
index 00000000..663322cb
--- /dev/null
+++ b/src/hooks/abrt-ccpp.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Install ABRT coredump hook
+
+[Service]
+Type=oneshot
+ExecStart=/usr/sbin/abrt-install-ccpp-hook install
+ExecStop=/usr/sbin/abrt-install-ccpp-hook uninstall
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target