diff options
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | abrt.spec | 57 | ||||
-rw-r--r-- | configure.ac | 7 | ||||
-rw-r--r-- | src/Daemon/Makefile.am | 5 | ||||
-rw-r--r-- | src/Daemon/abrtd.service | 11 |
5 files changed, 76 insertions, 7 deletions
diff --git a/Makefile.am b/Makefile.am index fb4ba702..6303e738 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,9 @@ ACLOCAL_AMFLAGS = -I m4 SUBDIRS = lib src inc po icons +DISTCHECK_CONFIGURE_FLAGS = \ + --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) + EXTRA_DIST = doc/coding-style abrt.spec abrt.pc.in doc/abrt-plugin/ doc/howto-write-reporter pkgconfigdir = $(libdir)/pkgconfig @@ -1,7 +1,11 @@ %{!?python_site: %define python_site %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(0)")} # platform-dependent %{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} - +%if 0%{?fedora} >= 14 + %define with_systemd 1 +%else + %define with_systemd 0 +%endif # please modify the "_buildid" define in a way that identifies # that the built package isn't the stock distribution package, # for example, by setting the define to ".local" or ".bz123456" @@ -41,6 +45,9 @@ BuildRequires: polkit-devel BuildRequires: libtar-devel, bzip2-devel, zlib-devel BuildRequires: intltool BuildRequires: bison +%if %{?with_systemd} +Requires: systemd-units +%endif BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: %{name}-libs = %{version}-%{release} Requires(pre): shadow-utils @@ -270,7 +277,38 @@ getent passwd abrt >/dev/null || useradd --system -g abrt -d /etc/abrt -s /sbin/ exit 0 %post +if [ $1 -eq 1 ]; then /sbin/chkconfig --add %{name}d +fi +#systemd +%if %{?with_systemd} +#if [ $1 -eq 1 ]; then +# Enable (but don't start) the units by default + /bin/systemctl enable %{name}d.service >/dev/null 2>&1 || : +#fi +%endif + +%preun +if [ "$1" -eq "0" ] ; then + service %{name}d stop >/dev/null 2>&1 + /sbin/chkconfig --del %{name}d +fi +#systemd +%if %{?with_systemd} +if [ "$1" -eq "0" ] ; then + /bin/systemctl stop %{name}d.service >/dev/null 2>&1 || : + /bin/systemctl disable %{name}d.service >/dev/null 2>&1 || : +fi +%endif + +%postun +#systemd +%if %{?with_systemd} +if [ $1 -ge 1 ] ; then +# On upgrade, reload init system configuration if we changed unit files + /bin/systemctl daemon-reload >/dev/null 2>&1 || : +fi +%endif %post gui # update icon cache @@ -281,12 +319,6 @@ fi %post libs -p /sbin/ldconfig -%preun -if [ "$1" -eq "0" ] ; then - service %{name}d stop >/dev/null 2>&1 - /sbin/chkconfig --del %{name}d -fi - %postun libs -p /sbin/ldconfig %postun gui @@ -299,10 +331,21 @@ fi if [ "$1" -eq "0" ]; then service %{name}d condrestart >/dev/null 2>&1 || : fi +#systemd +%if %{?with_systemd} +if [ "$1" -eq "0" ]; then + /bin/systemctl try-restart %{name}d.service >/dev/null 2>&1 || : +fi +%endif + %files -f %{name}.lang %defattr(-,root,root,-) %doc README COPYING +#systemd +%if %{?with_systemd} +/lib/systemd/system/%{name}d.service +%endif %{_sbindir}/%{name}d %{_bindir}/%{name}-debuginfo-install %{_bindir}/%{name}-handle-upload diff --git a/configure.ac b/configure.ac index 5a3addb2..e48ee0d8 100644 --- a/configure.ac +++ b/configure.ac @@ -56,6 +56,13 @@ PKG_CHECK_MODULES([XMLRPC], [xmlrpc]) PKG_CHECK_MODULES([XMLRPC_CLIENT], [xmlrpc_client]) PKG_CHECK_MODULES([POLKIT],[polkit-gobject-1]) +PKG_PROG_PKG_CONFIG +AC_ARG_WITH([systemdsystemunitdir], + AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), + [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]) +AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) +AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir"]) + AC_CHECK_HEADER([libtar.h], [], [AC_MSG_ERROR([libtar.h is needed to build abrt])]) diff --git a/src/Daemon/Makefile.am b/src/Daemon/Makefile.am index 34243b1d..ef67726c 100644 --- a/src/Daemon/Makefile.am +++ b/src/Daemon/Makefile.am @@ -54,6 +54,11 @@ man_MANS = abrtd.8 abrt.conf.5 EXTRA_DIST = $(man_MANS) abrt-debuginfo-install abrt-handle-upload +if HAVE_SYSTEMD +dist_systemdsystemunit_DATA = \ + abrtd.service +endif + DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ install-data-local: diff --git a/src/Daemon/abrtd.service b/src/Daemon/abrtd.service new file mode 100644 index 00000000..e170e324 --- /dev/null +++ b/src/Daemon/abrtd.service @@ -0,0 +1,11 @@ +[Unit] +Description=ABRT Automated Bug Reporting Tool +After=syslog.target + +[Service] +Type=dbus +BusName=com.redhat.abrt +ExecStart=/usr/sbin/abrtd -d -s + +[Install] +WantedBy=multi-user.target |