network/vnstat: Updated for version 1.6

This commit is contained in:
Michiel van Wessem 2010-05-11 19:46:05 +02:00 committed by Robby Workman
parent e846e1bf5f
commit 521e6c6ce4
5 changed files with 49 additions and 18 deletions

View file

@ -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

17
network/vnstat/doinst.sh Normal file
View file

@ -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

View file

@ -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:

View file

@ -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

View file

@ -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"