--- ganglia.git.orig/ganglia.spec.in 2014-02-27 16:17:31.133435913 +0100 +++ ganglia.git/ganglia.spec.in 2014-02-27 17:07:54.295052218 +0100 @@ -23,7 +23,7 @@ Group: System Environment/Base Source: %{name}-%{version}.tar.gz Buildroot: %{_tmppath}/%{name}-%{version}-buildroot -BuildRequires: libpng-devel, libart_lgpl-devel, gcc-c++, python-devel, libconfuse-devel, make, pcre-devel, autoconf, automake, libtool, pkgconfig +BuildRequires: libpng-devel, libart_lgpl-devel, gcc-c++, python-devel, libconfuse-devel, make, pcre-devel, autoconf, automake, libtool, pkgconfig, ck-devel %if 0%{?suse_version} BuildRequires: freetype2-devel, libapr1-devel %if 0%{?suse_version} > 1020 @@ -187,7 +187,11 @@ %ifnarch noarch %post gmetad +%if 0%{?_unitdir:1} +/bin/systemctl enable gmetad +%else /sbin/chkconfig --add gmetad +%endif if [ -e /etc/gmetad.conf ]; then %__mv /etc/gmetad.conf %{conf_dir} @@ -197,7 +201,11 @@ #/sbin/chkconfig --add gmetad-python %post gmond +%if 0%{?_unitdir:1} +/bin/systemctl enable gmond +%else /sbin/chkconfig --add gmond +%endif LEGACY_GMOND_CONF=%{conf_dir}/gmond.conf if [ -e /etc/gmond.conf ]; @@ -243,8 +251,13 @@ %preun gmetad if [ "$1" = 0 ] then +%if 0%{?_unitdir:1} + /bin/systemctl stop gmetad + /bin/systemctl disable gmetad +%else /etc/init.d/gmetad stop /sbin/chkconfig --del gmetad +%endif fi #%preun gmetad-python @@ -257,8 +270,13 @@ %preun gmond if [ "$1" = 0 ] then +%if 0%{?_unitdir:1} + /bin/systemctl stop gmond + /bin/systemctl disable gmond +%else /etc/init.d/gmond stop /sbin/chkconfig --del gmond +%endif fi %post -n libganglia -p /sbin/ldconfig @@ -287,10 +305,14 @@ %else # Create the directory structure +%if 0%{?!_unitdir:1} %__install -d -m 0755 $RPM_BUILD_ROOT/etc/init.d +%endif %__install -d -m 0755 $RPM_BUILD_ROOT/etc/sysconfig %__install -d -m 0755 $RPM_BUILD_ROOT@varstatedir@/ganglia/rrds +# If we are not using systemd, we need to install initrd files. +%if 0%{?!_unitdir:1} # Move the files into the structure %if 0%{?suse_version} %__cp -f gmond/gmond.init.SuSE $RPM_BUILD_ROOT/etc/init.d/gmond @@ -303,6 +325,7 @@ #sed -e 's/sbin\/gmetad/sbin\/gmetad.py/' gmetad/gmetad.init > $RPM_BUILD_ROOT/etc/init.d/gmetad-python #chmod +x $RPM_BUILD_ROOT/etc/init.d/gmetad-python %endif +%endif %__cp -f gmetad/gmetad-default $RPM_BUILD_ROOT/etc/sysconfig/gmetad %__install -d -m 0755 $RPM_BUILD_ROOT%{conf_dir} @@ -355,7 +378,11 @@ %defattr(-,root,root) %attr(0755,nobody,nobody)@varstatedir@/ganglia/ %{_sbindir}/gmetad +%if 0%{?_unitdir:1} +%{_unitdir}/gmetad.service +%else /etc/init.d/gmetad +%endif %config(noreplace) /etc/sysconfig/gmetad %{_mandir}/man1/gmetad*1* %config(noreplace) %{conf_dir}/gmetad.conf @@ -376,7 +403,11 @@ %{_bindir}/gmetric %{_bindir}/gstat %{_sbindir}/gmond +%if 0%{?_unitdir:1} +%{_unitdir}/gmond.service +%else /etc/init.d/gmond +%endif %{_mandir}/man1/gmetric.1* %{_mandir}/man1/gmond.1* %{_mandir}/man1/gstat.1* @@ -441,6 +472,8 @@ %__rm -rf $RPM_BUILD_ROOT %changelog +* Thu Feb 27 2014 Olivier Lahaye +- Add native systemd support in package. * Thu Mar 31 2011 Bernard Li - Allow file permissions for gmetric and gstat to be automatically set * Thu Mar 31 2011 Bernard Li