wok-6.x rev 18938

vnstat: add vnstatd daemon handling
author Aleksej Bobylev <al.bobylev@gmail.com>
date Tue Mar 01 13:43:15 2016 +0200 (2016-03-01)
parents 5f489761d0c4
children f0910e2be30c
files vnstat/receipt
line diff
     1.1 --- a/vnstat/receipt	Tue Mar 01 13:06:45 2016 +0200
     1.2 +++ b/vnstat/receipt	Tue Mar 01 13:43:15 2016 +0200
     1.3 @@ -10,7 +10,7 @@
     1.4  TARBALL="$PACKAGE-$VERSION.tar.gz"
     1.5  WGET_URL="${WEB_SITE}$TARBALL"
     1.6  
     1.7 -DEPENDS=""
     1.8 +DEPENDS="busybox"
     1.9  SUGGESTED="libgd"
    1.10  BUILD_DEPENDS="libgd-dev"
    1.11  
    1.12 @@ -23,6 +23,8 @@
    1.13  	$CONFIGURE_ARGS &&
    1.14  	make && make install
    1.15  	find $install/usr/share/man -type f -exec gzip \{\} \;
    1.16 +	mkdir -p $install/etc/init.d
    1.17 +	ln -s daemon $install/etc/init.d/vnstatd
    1.18  }
    1.19  
    1.20  # Rules to gen a SliTaz package suitable for Tazpkg.
    1.21 @@ -30,3 +32,25 @@
    1.22  {
    1.23  	cp -a $install/* $fs
    1.24  }
    1.25 +
    1.26 +post_install()
    1.27 +{
    1.28 +	# Start vnstat daemon and edit daemons.conf
    1.29 +	if [ -z "$1" -a ! -s /aufs-umount.sh ]; then
    1.30 +		/etc/init.d/vnstatd start || continue
    1.31 +	fi
    1.32 +	if ! grep -q ^VNSTATD_OPTIONS "$1/etc/daemons.conf"; then
    1.33 +		cat >> "$1/etc/daemons.conf" <<EOT
    1.34 +# vnstat daemon options.
    1.35 +VNSTATD_OPTIONS="-d -p /var/run/vnstatd.pid"
    1.36 +
    1.37 +EOT
    1.38 +	fi
    1.39 +}
    1.40 +
    1.41 +pre_remove()
    1.42 +{
    1.43 +	# Stop vnstat daemon before rm.
    1.44 +	[ -z "$1" -a -x /etc/init.d/vnstatd ] && /etc/init.d/vnstatd stop
    1.45 +	:
    1.46 +}