Files
bandwidthd/bandwidthd.spec
2025-09-03 00:41:31 -04:00

200 lines
6.3 KiB
RPMSpec

# You can compile this without postgresql support by running:
# rpmbuild -ba bandwidthd.spec --without pgsql
Name: bandwidthd
Version: 2.0.1.1
Release: 9%{?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
Patch3: bandwidthd-2.0.1.1-mariadb.patch
Patch4: 0001-Gracefuly-exit-upon-pcap_findalldevs-error.patch
Patch5: bandwidthd-gcc5.patch
# from Nethserver
#Patch6:
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: autoconf, gd-devel, libpng-devel
%{?!_without_pgsql:BuildRequires: postgresql-devel}
%if "0%{?dist}" == "0.el4" || "0%{?dist}" == "0.RHL4"
BuildRequires: libpcap
%else
BuildRequires: libpcap-devel
%endif
BuildRequires: bison, flex
BuildRequires: mysql-devel
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
generated by each machine on several configurable subnets. It is much
easier to configure than MRTG, and provides significantly more useful
information. MRTG only tells you how much bandwidth you are using,
Bandwidthd tells you that, and who is using it.
Each IP address that has moved any significant volume of traffic has its
own graph. The graphs are color coded to help you figure out at a glance
if your user is surfing the web, or surfing Kazaa.
Bandwidthd is targeted to run on my routing platforms. It is very low
overhead. Easily graphing small business traffic on a 133Mhz Elan 486
every 2.5 minutes. My entire ISP (2000-3000 IP addresses across 4 states)
is graphed on a Celeron 450 every 10 minutes.
%prep
%setup -q
%patch0 -p1
#-b .dest
%patch1 -p0
#-b .pgsql
%patch2 -p1
#-b .mysql
%patch3 -p1
%build
cp -af /usr/lib/rpm/config.{sub,guess} .
autoheader
autoconf
%configure --prefix=%{_prefix} \
--exec_prefix=%{_prefix} \
--sysconfdir=%{_sysconfdir} \
--bindir=%{_bindir} \
--localstatedir=%{_var}/www\
--datadir=%{_var}/www
make -j2
# # in place of make %{?_smp_mflags} as it will do -j4 on builder and one task will end before the one it needs
%install
rm -rf $RPM_BUILD_ROOT
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" \
> $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/%{name}.conf
# remove execute bit for gif and sh script without #!
chmod -x phphtdocs/*.gif
# prepare for mysql
#cp phphtdocs/*.php phphtdocs/*.conf phphtdocs/*.sh $RPM_BUILD_ROOT/var/www/%{name}/htdocs/
cp -a phphtdocs $RPM_BUILD_ROOT/var/www/%{name}/
%clean
rm -rf $RPM_BUILD_ROOT
%post
#%systemd_post %{name}.service
%preun
%systemd_preun %{name}.service
%postun
%systemd_postun_with_restart %{name}.service
%files
%defattr(-,root,root,-)
%doc README CHANGELOG TODO
%{?!_without_pgsql:%doc phphtdocs}
%attr(755,admin,www) %{_var}/www/%{name}/phphtdocs/*.php
%attr(755,admin,www) %{_var}/www/%{name}/phphtdocs/*.conf
%config(noreplace) %{_sysconfdir}/%{name}.conf
%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf
%attr(755,root,root) %{_sysconfdir}/rc.d/init.d/%{name}
%attr(644,root,root) %{_unitdir}/%{name}.service
%{_sbindir}/%{name}
%dir %{_var}/www/%{name}
%{_var}/www/%{name}/*
%attr(755,root,root) %{_var}/www/%{name}/phphtdocs/*.sh
%changelog
* Wed Jun 29 2022 Jean-Philippe Pialasse <tests@pialasse.com> 2.0.1.1-9.sme
- fix systemd unit chmod [SME: 11046]
* Sun Jun 06 2021 Jean-Philippe Pialasse <tests@pialasse.com> 2.0.1.1-8.sme
- use ENGINE in place of TYPE for mariadb
* Thu Jun 03 2021 Jean-Philippe Pialasse <tests@pialasse.com> 2.0.1.1-7.sme
- build test ; make -j2
* Wed Feb 03 2021 BogusDateBot
- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday,
by assuming the date is correct and changing the weekday.
Sun Dec 13 2008 --> Sun Dec 07 2008 or Sat Dec 13 2008 or Sun Dec 14 2008 or ....
* Thu Oct 22 2020 Brian Read <brianr@bjsystems.co.uk> 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 <stephdl@de-labrusse.fr> - 2.0.1.1-4
- Initial Import to sme9contribs
- corrected the failed patch bandwidthd-mysql.patch
* Sun Dec 29 2013 JP Pialasse <tests@pialasse.com> - 2.0.1.1-2
- adapted for SME8
- initial import
* Sat Mar 12 2011 JP Pialasse <tests@pialasse.com> - 2.0.1.1-1
- updated to CVS on 2005 sep 26 with mysql support patch
- added back autoconf and autoheader
- cond buid for rhel4
* Sat Dec 13 2008 Jan ONDREJ (SAL) <ondrejj(at)salstar.sk> - 2.0.1-11
Sun Dec 13 2008 --> Sun Dec 07 2008 or Sat Dec 13 2008 or Sun Dec 14 2008 or ....
- updated config.sub and config.guess to build on ppc64
- added libpng-devel again (required for EPEL-4)
* Sat Dec 13 2008 Jan ONDREJ (SAL) <ondrejj(at)salstar.sk> - 2.0.1-8
- removed dependency on gd
- removed one line of autoconf
- removed dependency on libpng-devel
- phphtdocs added for pgsql build, execute bit for gif and sh removed
* Mon Dec 8 2008 Jan ONDREJ (SAL) <ondrejj(at)salstar.sk> - 2.0.1-7
- changed License to GPL+
* Mon Dec 8 2008 Jan ONDREJ (SAL) <ondrejj(at)salstar.sk> - 2.0.1-6
- buildroot macro replaced by RPM_BUILD_ROOT variable
- added autoconf into build-requires
- by default compiled with postgresql support
- conditional build without postgresql (--without pgsql)
- libpng removed from requires
* Mon Dec 8 2008 Jan ONDREJ (SAL) <ondrejj(at)salstar.sk> - 2.0.1-5
- conditional build for el4
* Sun Sep 9 2007 Jan ONDREJ (SAL) <ondrejj(at)salstar.sk> - 2.0.1-4
- updated license and summary
- changed init script permissions
* Tue Mar 13 2007 Jan ONDREJ (SAL) <ondrejj(at)salstar.sk>
- updated from version by Michal Ambroz <rebus@seznam.cz>
- added apache configuration script
- moved into /var/www/bandwidthd
- spec file name typo fixed