[bandwidthd: 2/5] added systemd service file

Ján ONDREJ ondrejj at fedoraproject.org
Thu Nov 17 08:26:04 UTC 2011


commit 0ca5e660a52f85ccb63b5e0ebff902f573dc4176
Author: Jan ONDREJ (SAL) <ondrejj(at)salstar.sk>
Date:   Wed Nov 16 20:35:28 2011 +0100

    added systemd service file

 bandwidthd.spec |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/bandwidthd.spec b/bandwidthd.spec
index e3f7766..88a674b 100644
--- a/bandwidthd.spec
+++ b/bandwidthd.spec
@@ -3,14 +3,15 @@
 
 Name:           bandwidthd
 Version:        2.0.1
-Release:        15%{?dist}
+Release:        16%{?dist}
 Summary:        Tracks network usage and builds html and graphs
 
 Group:          System Environment/Daemons
 License:        GPL+
 URL:            http://bandwidthd.sourceforge.net/
 Source0:        http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tgz
-Source1:        %{name}
+Source1:	%{name}
+Source2:	%{name}.service
 Patch0:         bandwidthd-destdir.patch
 Patch1:         bandwidthd-pgsql.patch
 Patch2:		http://v3.sk/~lkundrak/0001-Gracefuly-exit-upon-pcap_findalldevs-error.patch
@@ -25,6 +26,9 @@ BuildRequires:  libpcap-devel
 Requires(post): /sbin/chkconfig
 Requires(preun):/sbin/chkconfig
 Requires(preun):/sbin/service
+%if 0%{?fedora} || 0%{?rhel} > 6
+BuildRequires: systemd-units
+%endif
 
 %description
 Bandwidthd is a UNIX daemon/Windows service for graphing the traffic
@@ -66,7 +70,11 @@ rm -rf $RPM_BUILD_ROOT
 make install DESTDIR=$RPM_BUILD_ROOT
 # init script
 install -d $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d
+%if 0%{?fedora} || 0%{?rhel} > 6
+install %{SOURCE2} $RPM_BUILD_ROOT%{_unitdir}/
+%else
 install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/
+%endif
 # install apache configuration
 install -d $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d
 echo "Alias /%{name} %{_var}/www/%{name}/htdocs" \
@@ -95,13 +103,20 @@ fi
 %{?!_without_pgsql:%doc phphtdocs}
 %config(noreplace) %{_sysconfdir}/%{name}.conf
 %config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf
+%if 0%{?fedora} || 0%{?rhel} > 6
+%{_unitdir}/%{name}.service
+%else
 %attr(755,root,root) %{_sysconfdir}/rc.d/init.d/%{name}
+%endif
 %{_sbindir}/%{name}
 %dir %{_var}/www/%{name}
 %{_var}/www/%{name}/*
 
 
 %changelog
+* Wed Nov 16 2011 Ján ONDREJ (SAL) <ondrejj(at)salstar.sk> - 2.0.1-16
+- added native systemd service (bz#754478)
+
 * Wed Dec 09 2009 Ján ONDREJ (SAL) <ondrejj(at)salstar.sk> - 2.0.1-15
 - Applied patch from lkundrak to do not hang when no devices found. bz#537073
 


More information about the scm-commits mailing list