284 lines
9.3 KiB
RPMSpec
284 lines
9.3 KiB
RPMSpec
Summary: Console-based network traffic monitor
|
|
Name: vnstat
|
|
Version: 1.11
|
|
Release: 22%{?dist}
|
|
|
|
License: GPLv2
|
|
Group: System Environment/Daemons
|
|
URL: http://humdi.net/vnstat/
|
|
Source0: http://humdi.net/vnstat/vnstat-%{version}.tar.gz
|
|
Source1: vnstat.service
|
|
Requires(pre): shadow-utils
|
|
Requires(post): systemd-units
|
|
Requires(preun): systemd-units
|
|
Requires(postun): systemd-units
|
|
BuildRequires: gd-devel
|
|
BuildRequires: systemd
|
|
Patch0: vnstat-run-vnstat.diff
|
|
Patch1: vnstat-1.11-there-are-only-12-months.patch
|
|
|
|
%description
|
|
vnStat is a console-based network traffic monitor that keeps a log of daily
|
|
network traffic for the selected interface(s). vnStat isn't a packet sniffer.
|
|
The traffic information is analyzed from the /proc-filesystem, so vnStat can
|
|
be used without root permissions. See the webpage for few 'screenshots'.
|
|
|
|
%prep
|
|
%setup -q
|
|
%patch0 -p1
|
|
%patch1 -p1
|
|
|
|
# disable maximum bandwidth setting and change pidfile location
|
|
sed -i -e "s,/var/run/,/run/vnstat/,g; \
|
|
s,MaxBandwidth 100,MaxBandwidth 0,g;" \
|
|
cfg/vnstat.conf
|
|
|
|
# Use -p everywhere, -s nowhere
|
|
%{__sed} -i -e "s,install \(-s \)\?,install -p ," Makefile
|
|
|
|
%build
|
|
%{__make} %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" all
|
|
|
|
%install
|
|
%{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/cron.d
|
|
%{__mkdir_p} $RPM_BUILD_ROOT%{_unitdir}
|
|
%{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
|
|
%{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d
|
|
|
|
%{__mkdir_p} %{buildroot}/run/
|
|
%{__install} -d -m 0700 %{buildroot}/run/%{name}/
|
|
|
|
%{__make} install DESTDIR=$RPM_BUILD_ROOT
|
|
%{__install} -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/
|
|
%{__rm} -rf examples/init.d
|
|
%{__chmod} 644 examples/vnstat.cgi
|
|
%{__chmod} 644 examples/vnstat.cron
|
|
|
|
%{__cat} >> $RPM_BUILD_ROOT%{_sysconfdir}/cron.d/%{name} << END
|
|
MAILTO=root
|
|
# to enable interface monitoring via vnstat remove comment on next line
|
|
# */5 * * * * vnstat %{_sbindir}/%{name}.cron
|
|
END
|
|
|
|
%{__cat} >> $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name} << END
|
|
# see also: vnstat(1)
|
|
#
|
|
# starting with vnstat-1.6 vnstat can also be
|
|
# configured via %{_sysconfdir}/vnstat.conf
|
|
#
|
|
# the following sets vnstat up to monitor eth0
|
|
VNSTAT_OPTIONS="-u -i eth0"
|
|
END
|
|
|
|
%{__cat} >> $RPM_BUILD_ROOT%{_sbindir}/%{name}.cron << END
|
|
#!/bin/bash
|
|
# this script (%{_sbindir}/%{name}.cron) reads %{_sysconfdir}/sysconfig/%{name}
|
|
# to start %{_bindir}/%{name}.
|
|
# example for %{_sysconfdir}/sysconfig/%{name}:
|
|
# VNSTAT_OPTIONS="-u -i eth0"
|
|
# see also: vnstat(1)
|
|
|
|
VNSTAT_CONF=%{_sysconfdir}/sysconfig/%{name}
|
|
|
|
if [ ! -f \$VNSTAT_CONF ]; then
|
|
exit 0
|
|
fi
|
|
|
|
. \$VNSTAT_CONF
|
|
|
|
%{_bindir}/%{name} \$VNSTAT_OPTIONS
|
|
END
|
|
|
|
%{__cat} >> $RPM_BUILD_ROOT/%{_sysconfdir}/tmpfiles.d/vnstat.conf << END
|
|
D /run/vnstat 0700 vnstat vnstat
|
|
END
|
|
|
|
%pre
|
|
getent group %{name} > /dev/null || %{_sbindir}/groupadd -r %{name}
|
|
getent passwd %{name} > /dev/null || %{_sbindir}/useradd -r -g %{name} -M \
|
|
-d %{_localstatedir}/lib/%{name} -s /sbin/nologin -c "vnStat user" %{name}
|
|
|
|
%post
|
|
%systemd_post vnstat.service
|
|
|
|
%preun
|
|
%systemd_preun vnstat.service
|
|
|
|
%postun
|
|
%systemd_postun_with_restart vnstat.service
|
|
|
|
%triggerun -- vnstat < 1.11-8
|
|
# Save the current service runlevel info
|
|
# User must manually run systemd-sysv-convert --apply httpd
|
|
# to migrate them to systemd targets
|
|
/usr/bin/systemd-sysv-convert --save vnstat >/dev/null 2>&1 ||:
|
|
|
|
# Run these because the SysV package being removed won't do them
|
|
/sbin/chkconfig --del vnstat >/dev/null 2>&1 || :
|
|
/bin/systemctl try-restart vnstat.service >/dev/null 2>&1 || :
|
|
|
|
|
|
%files
|
|
%defattr(-,root,root,-)
|
|
%doc CHANGES COPYING FAQ README INSTALL examples
|
|
%config(noreplace) %{_sysconfdir}/%{name}.conf
|
|
%config(noreplace) %{_sysconfdir}/cron.d/%{name}
|
|
%{_unitdir}/%{name}.service
|
|
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
|
|
%{_sysconfdir}/tmpfiles.d/vnstat.conf
|
|
%{_mandir}/man*/*
|
|
%{_bindir}/vnstat
|
|
%{_bindir}/vnstati
|
|
%{_sbindir}/vnstatd
|
|
%attr(-,vnstat,vnstat)%dir /run/%{name}/
|
|
%attr(755,root,root)%{_sbindir}/%{name}.cron
|
|
%attr(-,vnstat,vnstat)%{_localstatedir}/lib/%{name}
|
|
|
|
|
|
%changelog
|
|
* Sun Oct 26 2014 Adrian Reber <adrian@lisas.de> - 1.11-22
|
|
- install unit file as 644 and not 755 (fixes #1157199)
|
|
|
|
* Thu Aug 21 2014 Kevin Fenzi <kevin@scrye.com> - 1.11-21
|
|
- Rebuild for rpm bug 1131960
|
|
|
|
* Mon Aug 18 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.11-20
|
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
|
|
|
|
* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.11-19
|
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
|
|
|
|
* Wed Aug 07 2013 Adrian Reber <adrian@lisas.de> - 1.11-18
|
|
- fix bogus dates
|
|
- added patch for
|
|
"vnstat.c:489:22: warning: iteration 12u invokes undefined behavior [-Waggressive-loop-optimizations]"
|
|
|
|
* Wed Aug 07 2013 Mathieu Bridon <bochecha@fedoraproject.org> - 1.11-17
|
|
- Fix the build by adding the missing BR on systemd.
|
|
|
|
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.11-16
|
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
|
|
|
|
* Tue Jun 11 2013 Remi Collet <rcollet@redhat.com> - 1.11-15
|
|
- rebuild for new GD 2.1.0
|
|
|
|
* Fri Mar 08 2013 Adrian Reber <adrian@lisas.de> - 1.11-14
|
|
- spec cleanup
|
|
|
|
* Thu Mar 07 2013 Adrian Reber <adrian@lisas.de> - 1.11-13
|
|
- fixed "/usr/sbin/vnstat.cron is incorrect" (#919157)
|
|
|
|
* Fri Feb 15 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.11-12
|
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
|
|
|
|
* Fri Aug 24 2012 Adrian Reber <adrian@lisas.de> - 1.11-11
|
|
- fixed "Introduce new systemd-rpm macros in vnstat spec file" (#850361)
|
|
|
|
* Sun Jul 22 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.11-9
|
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
|
|
|
|
* Tue Feb 14 2012 Jon Ciesla <limburgher@gmail.com> - 1.11-8
|
|
- Update to systemd, BZ 661325.
|
|
|
|
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.11-7
|
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
|
|
|
|
* Thu Dec 22 2011 Adrian Reber <adrian@lisas.de> - 1.11-6
|
|
- fixed /run/%%{name}/ permissions
|
|
|
|
* Thu Dec 22 2011 Adrian Reber <adrian@lisas.de> - 1.11-5
|
|
- added /run/%%{name}/ directory to file list
|
|
|
|
* Thu Dec 22 2011 Adrian Reber <adrian@lisas.de> - 1.11-4
|
|
- added patch to check for pidfile in /run/vnstat
|
|
|
|
* Tue Nov 29 2011 Adrian Reber <adrian@lisas.de> - 1.11-3
|
|
- create file in tmpfiles.d for pidfile (#750141)
|
|
|
|
* Tue Jun 28 2011 Adrian Reber <adrian@lisas.de> - 1.11-2
|
|
- do not run vnstatd as the root user but as the vnstat user (#711995)
|
|
|
|
* Thu Jun 02 2011 Robert Scheck <robert@fedoraproject.org> - 1.11-1
|
|
- Upgrade to 1.11
|
|
|
|
* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.10-2
|
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
|
|
|
|
* Sun Jan 03 2010 Robert Scheck <robert@fedoraproject.org> - 1.10-1
|
|
- Upgrade to 1.10
|
|
|
|
* Sat Dec 26 2009 Robert Scheck <robert@fedoraproject.org> - 1.9-2
|
|
- Work around a buffer overflow in vnstati until 1.10 (#550635)
|
|
|
|
* Sat Dec 26 2009 Robert Scheck <robert@fedoraproject.org> - 1.9-1
|
|
- Upgrade to 1.9 and make rpmlint more silent
|
|
- Make %%pre script with useradd more conform to guidelines
|
|
- Replace %%{_initddir} macro for more easy EPEL support
|
|
- Preserve timestamps when using sed to manipulate files
|
|
|
|
* Wed Nov 18 2009 Ville Skyttä <ville.skytta@iki.fi> - 1.8-7
|
|
- Prevent upstream build from stripping binaries before rpmbuild does it.
|
|
|
|
* Mon Nov 09 2009 Adrian Reber <adrian@lisas.de> - 1.8-6
|
|
- to not activate vnstatd by default
|
|
- remove executable bit from perl cgi example
|
|
- do not package example startup scripts
|
|
|
|
* Wed Aug 5 2009 Axel Thimm <Axel.Thimm@ATrpms.net> - 1.8-5
|
|
- update to 1.8
|
|
- add vnstatd, vnstati (by using default Makefile install target)
|
|
- add initscript for vnstatd
|
|
|
|
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6-4
|
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
|
|
|
|
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6-3
|
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
|
|
|
|
* Mon Feb 18 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 1.6-2
|
|
- Autorebuild for GCC 4.3
|
|
|
|
* Sun Jan 13 2008 Adrian Reber <adrian@lisas.de> - 1.6-1
|
|
- updated to 1.6
|
|
- added vnstat.conf to %%{_sysconfdir}
|
|
- fixed a few rpmlint warnings
|
|
|
|
* Thu Oct 11 2007 Adrian Reber <adrian@lisas.de> - 1.4-10
|
|
- rebuilt for BuildID
|
|
- updated license tag
|
|
|
|
* Mon Feb 26 2007 Adrian Reber <adrian@lisas.de> - 1.4-9
|
|
- applied patch for spec file cleanup (#229037)
|
|
|
|
* Fri Sep 15 2006 Adrian Reber <adrian@lisas.de> - 1.4-8
|
|
- rebuilt
|
|
|
|
* Fri Mar 17 2006 Adrian Reber <adrian@lisas.de> - 1.4-7
|
|
- rebuilt; fixed dist tag
|
|
|
|
* Fri Mar 17 2006 Adrian Reber <adrian@lisas.de> - 1.4-6
|
|
- rebuilt
|
|
|
|
* Sun May 22 2005 Jeremy Katz <katzj@redhat.com> - 1.4-5
|
|
- rebuild on all arches
|
|
|
|
* Fri Apr 8 2005 Michael Schwendt <mschwendt[AT]users.sf.net>
|
|
- rebuilt
|
|
|
|
* Mon Feb 28 2005 Adrian Reber <adrian@lisas.de> 1.4-3
|
|
- removed occurences of VNSTAT_DISABLED in
|
|
%%{_sysconfdir}/sysconfig/%%{name} and
|
|
%%{_sbindir}/%{name}.cron
|
|
|
|
* Thu Feb 24 2005 Adrian Reber <adrian@lisas.de> 1.4-2
|
|
- removed "#--------------"
|
|
- added %%{version} to Source0
|
|
- replaced almost empty FAQ with the one from the web
|
|
- added INSTALL to %%doc
|
|
- added %%{_sysconfdir}/sysconfig/%%{name}
|
|
and %%{_sbindir}/%%{name}.cron to allow flexible configuration
|
|
- cron script and configuration file defaults to vnstat disabled
|
|
- added example scripts from cron/* and pppd/* to %%doc
|
|
|
|
* Wed Jul 21 2004 Adrian Reber <adrian@lisas.de> 1.4-1
|
|
- initial build
|