--- rpms/bandwidthd/contribs10/bandwidthd.spec 2020/10/21 11:20:49 1.1 +++ rpms/bandwidthd/contribs10/bandwidthd.spec 2020/11/20 10:34:50 1.2 @@ -3,14 +3,17 @@ Name: bandwidthd Version: 2.0.1.1 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Tracks network usage and builds html and graphs Group: System Environment/Daemons License: GPL+ URL: http://bandwidthd.sourceforge.net/ Source0: bandwidthd-2.0.1.1.tgz + Source1: %{name} +Source2: %{name}.service + Patch0: bandwidthd-destdir.patch Patch1: bandwidthd-pgsql.patch Patch2: bandwidthd-mysql.patch @@ -24,9 +27,12 @@ BuildRequires: libpcap-devel %endif BuildRequires: bison, flex BuildRequires: mysql-devel -Requires(post): /sbin/chkconfig -Requires(preun):/sbin/chkconfig -Requires(preun):/sbin/service + +Requires(post): systemd-units +Requires(preun): systemd-units +Requires(postun): systemd-units +BuildRequires: systemd-units + %description Bandwidthd is a UNIX daemon/Windows service for graphing the traffic @@ -73,6 +79,11 @@ make install DESTDIR=$RPM_BUILD_ROOT # init script install -d $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/ + +mkdir -p $RPM_BUILD_ROOT%{_unitdir} +install %{SOURCE2} $RPM_BUILD_ROOT%{_unitdir}/ + + # install apache configuration install -d $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d echo "Alias /%{name} %{_var}/www/%{name}/htdocs" \ @@ -89,13 +100,13 @@ rm -rf $RPM_BUILD_ROOT %post -/sbin/chkconfig --add bandwidthd +#%systemd_post %{name}.service %preun -if [ $1 = 0 ]; then - /sbin/service bandwidthd stop > /dev/null 2>&1 - /sbin/chkconfig --del bandwidthd -fi +%systemd_preun %{name}.service + +%postun +%systemd_postun_with_restart %{name}.service %files @@ -107,12 +118,20 @@ fi %config(noreplace) %{_sysconfdir}/%{name}.conf %config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf %attr(755,root,root) %{_sysconfdir}/rc.d/init.d/%{name} + +%{_unitdir}/%{name}.service + + %{_sbindir}/%{name} %dir %{_var}/www/%{name} %{_var}/www/%{name}/* %attr(755,root,root) %{_var}/www/%{name}/phphtdocs/*.sh %changelog +* Thu Oct 22 2020 Brian Read 2.0.1.1-5.sme +- Initial import into SME10 tree [SME: 11046 ] +- Sort out spec file for systemd and add bandwidthd.service file + * Sat Sep 19 2015 stephane de Labrusse - 2.0.1.1-4 - Initial Import to sme9contribs - corrected the failed patch bandwidthd-mysql.patch