From 521e6c6ce4dfd2eea8da0394053c42688d668d5c Mon Sep 17 00:00:00 2001 From: Michiel van Wessem Date: Tue, 11 May 2010 19:46:05 +0200 Subject: network/vnstat: Updated for version 1.6 --- network/vnstat/README | 3 +-- network/vnstat/doinst.sh | 17 +++++++++++++++++ network/vnstat/slack-desc | 20 ++++++++++++++------ network/vnstat/vnstat.SlackBuild | 21 ++++++++++++++------- network/vnstat/vnstat.info | 6 +++--- 5 files changed, 49 insertions(+), 18 deletions(-) create mode 100644 network/vnstat/doinst.sh (limited to 'network/vnstat') diff --git a/network/vnstat/README b/network/vnstat/README index f7fbb85607..a22949bbfb 100644 --- a/network/vnstat/README +++ b/network/vnstat/README @@ -7,5 +7,4 @@ This program is open source (GPL) and can be installed in 'single' and 'root' mode. Add the following line to your crontab: -0-55/5 * * * * root if [ -x /usr/bin/vnstat ] && \ -[ `ls /var/lib/vnstat/ | wc -l` -ge 1 ]; then /usr/bin/vnstat -u; fi +0-55/5 * * * * if [[ -x /usr/bin/vnstat && $(ls /var/lib/vnstat/ | wc -l) -ge 1 ]]; then /usr/bin/vnstat -u; fi diff --git a/network/vnstat/doinst.sh b/network/vnstat/doinst.sh new file mode 100644 index 0000000000..206b717881 --- /dev/null +++ b/network/vnstat/doinst.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +config etc/vnstat.conf.new + diff --git a/network/vnstat/slack-desc b/network/vnstat/slack-desc index 3f3eed06a4..69c6620d03 100644 --- a/network/vnstat/slack-desc +++ b/network/vnstat/slack-desc @@ -1,11 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| vnstat: vnStat (a console-based network traffic monitor) vnstat: -vnstat: vnStat is a network traffic monitor for Linux that keeps a log of daily -vnstat: network traffic for the selected interface(s). vnStat isn't a packet -vnstat: sniffer. The traffic information is analyzed from the /proc filesystem, -vnstat: so vnStat can be used without root permissions. This program is open -vnstat: source (GPL) and can be installed in 'single' and 'root' mode. +vnstat: vnStat is a network traffic monitor for Linux that keeps a log of +vnstat: daily network traffic for the selected interface(s). vnStat isn't a +vnstat: packetsniffer. The traffic information is analyzed from the /proc +vnstat: filesystem so vnStat can be used without root permissions. This +vnstat: program is open source (GPL) and can be installed in 'single' and +vnstat: 'root' mode. vnstat: vnstat: homepage: http://humdi.net/vnstat/ vnstat: -vnstat: diff --git a/network/vnstat/vnstat.SlackBuild b/network/vnstat/vnstat.SlackBuild index 3525ebd146..b31203c273 100644 --- a/network/vnstat/vnstat.SlackBuild +++ b/network/vnstat/vnstat.SlackBuild @@ -22,15 +22,12 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# Modified by the SlackBuilds.org project - -set -e - PRGNAM=vnstat -VERSION=1.4 +VERSION=1.6 ARCH=${ARCH:-i486} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} + CWD=$(pwd) TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM @@ -38,6 +35,8 @@ OUTPUT=${OUTPUT:-/tmp} DOCFILES="CHANGES COPYING FAQ INSTALL README UNINSTALL UPGRADE" +set -e + rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP @@ -45,13 +44,19 @@ rm -rf $PRGNAM-$VERSION tar -xzvf $CWD/$PRGNAM-$VERSION.tar.gz cd $PRGNAM-$VERSION chown -R root:root . -chmod -R u+w,go+r-w,a-s . +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \; # vnstat doesn't have a proper configure. So we set the locations in the # Makefiles properly by the way of sed-fu sed -i 's#MAN = $(DESTDIR)/usr/share/man#MAN = $(DESTDIR)/usr/man#' \ $TMP/$PRGNAM-$VERSION/Makefile -sed -i 's#CRON = $(DESTDIR)/etc/cron.d#CRON = $(DESTDIR)/usr/doc/vnstat-1.4/scripts#' \ +sed -i "s#CRON = \$(DESTDIR)/etc/cron.d#CRON = \$(DESTDIR)/usr/doc/$PRGNAM-$VERSION/scripts#" \ + $TMP/$PRGNAM-$VERSION/Makefile +sed -i 's#install -m 644 cfg/vnstat.conf $(DESTDIR)/etc;#install -D -m 644 cfg/vnstat.conf $(DESTDIR)/etc/vnstat.conf.new;#' \ $TMP/$PRGNAM-$VERSION/Makefile # Set the compile flags in the src/Makefile properly @@ -70,6 +75,7 @@ make install DESTDIR=$PKG find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null ) + ( cd $PKG/usr/man find . -type f -exec gzip -9 {} \; for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done @@ -83,6 +89,7 @@ cp -a pppd/* $PKG/usr/doc/$PRGNAM-$VERSION/scripts cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install +cat $CWD/doinst.sh > $PKG/install/doinst.sh cat $CWD/slack-desc > $PKG/install/slack-desc cd $PKG diff --git a/network/vnstat/vnstat.info b/network/vnstat/vnstat.info index be9e48ba38..3130fa8322 100644 --- a/network/vnstat/vnstat.info +++ b/network/vnstat/vnstat.info @@ -1,8 +1,8 @@ PRGNAM="vnstat" -VERSION="1.4" +VERSION="1.6" HOMEPAGE="http://humdi.net/vnstat/" -DOWNLOAD="http://humdi.net/vnstat/vnstat-1.4.tar.gz" -MD5SUM="9184f79b5e60499bc059f670032291e5" +DOWNLOAD="http://humdi.net/vnstat/vnstat-1.6.tar.gz" +MD5SUM="9f88dc8278cd49532c1b4485f5ed4ba7" MAINTAINER="Michiel van Wessem" EMAIL="michiel@slackbuilds.org" APPROVED="rworkman" -- cgit v1.2.3