diff --git a/.gitignore b/.gitignore index 8504eb2..ef31a55 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ vnstat-1.11.tar.gz +/vnstat-1.14.tar.gz diff --git a/sources b/sources index f615528..2dfc971 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -a5a113f9176cd61fb954f2ba297f5fdb vnstat-1.11.tar.gz +1df5dccff4d84f2995f840db4cac2ed0 vnstat-1.14.tar.gz diff --git a/vnstat-1.11-there-are-only-12-months.patch b/vnstat-1.11-there-are-only-12-months.patch deleted file mode 100644 index 41806c0..0000000 --- a/vnstat-1.11-there-are-only-12-months.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- vnstat-1.11/src/vnstat.c.old 2011-06-01 00:29:51.000000000 +0200 -+++ vnstat-1.11/src/vnstat.c 2013-08-07 14:42:58.396231450 +0200 -@@ -485,7 +485,7 @@ - readdb(interface, dirname); - - data.totalrx=data.totaltx=data.totalrxk=data.totaltxk=0; -- for (i=0; i<=29; i++) { -+ for (i=0; i<=12; i++) { - if (data.month[i].used) { - addtraffic(&data.totalrx, &data.totalrxk, data.month[i].rx, data.month[i].rxk); - addtraffic(&data.totaltx, &data.totaltxk, data.month[i].tx, data.month[i].txk); diff --git a/vnstat-run-vnstat.diff b/vnstat-run-vnstat.diff deleted file mode 100644 index b3d464d..0000000 --- a/vnstat-run-vnstat.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- a/src/vnstatd.c 2011-06-01 00:29:51.000000000 +0200 -+++ b/src/vnstatd.c 2011-12-22 22:23:22.512967108 +0100 -@@ -482,10 +482,18 @@ - /* lock / pid file */ - pidfile = open(cfg.pidfile, O_RDWR|O_CREAT, 0644); - if (pidfile<0) { -- perror("pidfile"); -- snprintf(errorstring, 512, "pidfile failed, exiting."); -- printe(PT_Error); -- exit(EXIT_FAILURE); /* can't open */ -+ /* for Fedora's move to systemd and /run check -+ * for /run/vnstat/vnstat.pid, so that it needs no changes -+ * to the config file */ -+ pidfile = open("/run/vnstat/vnstat.pid", O_RDWR|O_CREAT, 0644); -+ if (pidfile<0) { -+ perror("pidfile"); -+ snprintf(errorstring, 512, "pidfile failed, exiting."); -+ printe(PT_Error); -+ exit(EXIT_FAILURE); /* can't open */ -+ } else { -+ strncpy(cfg.pidfile, "/run/vnstat/vnstat.pid", 512); -+ } - } - if (lockf(pidfile,F_TLOCK,0)<0) { - perror("pidfile lock"); diff --git a/vnstat.service b/vnstat.service deleted file mode 100644 index 3efda38..0000000 --- a/vnstat.service +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=VnStat - Lightweight Network Traffic Monitor -After=network.target - -[Service] -User=vnstat -ExecStart=/usr/sbin/vnstatd -d - -[Install] -WantedBy=multi-user.target diff --git a/vnstat.spec b/vnstat.spec index c857ea9..3afb523 100644 --- a/vnstat.spec +++ b/vnstat.spec @@ -1,32 +1,27 @@ Summary: Console-based network traffic monitor Name: vnstat -Version: 1.11 -Release: 23%{?dist} +Version: 1.14 +Release: 1%{?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 +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd 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'. +The traffic information is analyzed from the /proc file-system, so vnStat can +be used without root permissions. See the web-page 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; \ @@ -40,63 +35,29 @@ sed -i -e "s,/var/run/,/run/vnstat/,g; \ %{__make} %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" all %install -%{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/cron.d +%{__mkdir_p} $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name} %{__mkdir_p} $RPM_BUILD_ROOT%{_unitdir} -%{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig -%{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d +%{__mkdir_p} $RPM_BUILD_ROOT%{_tmpfilesdir} %{__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}/ +%{__install} -p -m 644 examples/systemd/vnstat.service $RPM_BUILD_ROOT%{_unitdir}/ %{__rm} -rf examples/init.d -%{__chmod} 644 examples/vnstat.cgi -%{__chmod} 644 examples/vnstat.cron +%{__rm} -rf examples/systemd +%{__rm} -rf examples/launchd +%{__rm} -rf examples/upstart -%{__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 +%{__cat} >> $RPM_BUILD_ROOT/%{_tmpfilesdir}/%{name}.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 \ +getent group %{name} > /dev/null || groupadd -r %{name} +getent passwd %{name} > /dev/null || useradd -r -g %{name} -M \ -d %{_localstatedir}/lib/%{name} -s /sbin/nologin -c "vnStat user" %{name} +exit 0 %post %systemd_post vnstat.service @@ -122,20 +83,23 @@ getent passwd %{name} > /dev/null || %{_sbindir}/useradd -r -g %{name} -M \ %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 +%{_tmpfilesdir}/%{name}.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 +* Tue Aug 11 2015 Adrian Reber - 1.14-1 +- Upgrade to 1.14 +- Remove cron based setup (removed functionality) +- Remove systemd unit file (now included) +- Remove unnecessary patches + * Fri Jun 19 2015 Fedora Release Engineering - 1.11-23 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild @@ -271,7 +235,7 @@ getent passwd %{name} > /dev/null || %{_sbindir}/useradd -r -g %{name} -M \ * Mon Feb 28 2005 Adrian Reber 1.4-3 - removed occurences of VNSTAT_DISABLED in %%{_sysconfdir}/sysconfig/%%{name} and - %%{_sbindir}/%{name}.cron + %%{_sbindir}/%%{name}.cron * Thu Feb 24 2005 Adrian Reber 1.4-2 - removed "#--------------"