testing/ntop: new aport

This commit is contained in:
Leonardo Arena 2010-10-15 07:35:36 +00:00
parent 5af4927d43
commit 034e17e208
4 changed files with 109 additions and 0 deletions

49
testing/ntop/APKBUILD Normal file
View File

@ -0,0 +1,49 @@
# Contributor:
# Maintainer: Leonardo Arena <rnalrd@gmail.com>
pkgname=ntop
pkgver=4.0
pkgrel=0
pkgdesc="Network traffic probe"
url="http://www.ntop.org"
license="GPL"
depends=
makedepends="autoconf automake freetype-dev gdbm-dev geoip-dev libart-lgpl-dev
libevent-dev libpcap-dev libpng-dev libtool libxml2-dev lua-dev
openssl-dev python-dev rrdtool-dev wget zlib-dev"
install=
subpackages="$pkgname-dev $pkgname-doc"
source="http://downloads.sourceforge.net/project/$pkgname/$pkgname/$pkgname-$pkgver/$pkgname-$pkgver.tar.gz
ntop.initd
ntop.confd
ntop-update-geoip-db"
_builddir="$srcdir"/$pkgname-$pkgver
prepare() {
cd "$_builddir"
# apply patches here
}
build() {
cd "$_builddir"
./autogen.sh --prefix=/usr \
--sysconfdir=/etc \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--disable-snmp
make || return 1
}
package() {
cd "$_builddir"
make DESTDIR="$pkgdir" install
# remove the 2 lines below (and this) if there is no init.d script
install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
}
md5sums="c5fc7863d8ba08654ef7b4d88ff860f4 ntop-4.0.tar.gz
7fd4edf07305e0f52867256c946a5747 ntop.initd
1303915a8435560acf27748ea0cea484 ntop.confd
080de490aeed421775e6f2472d86cb94 ntop-update-geoip-db"

View File

@ -0,0 +1,21 @@
#!/bin/sh
BASE_URL=http://geolite.maxmind.com/download/geoip/database
echo "Updating NTOP GeoIP databases..."
cd /var/lib/ntop || exit
for u in asnum/GeoIPASNum.dat.gz GeoLiteCity.dat.gz ; do
FILE_GZ=${u#*/}
FILE=${FILE_GZ%.gz}
wget -nv -O ${FILE_GZ} ${BASE_URL}/${u} &&
gunzip < ${FILE_GZ} > .${FILE} &&
mv -f .${FILE} ${FILE} &&
rm -f ${FILE_GZ} ||
exit
done
/etc/init.d/ntop --quiet status && /etc/init.d/ntop restart
echo "NTOP GeoIP databases were successfully updated"

9
testing/ntop/ntop.confd Normal file
View File

@ -0,0 +1,9 @@
# Config file for /etc/init.d/ntop
# Set preferred options here
#NTOP_OPTS="--http-server 3000 --https-server 0 --interface eth0"
# suggestions from bug #136983 (use it in case you experience ntop hangs)
#NTOP_OPTS="u ntop -P /var/lib/ntop --disable-schedyield --http-server 3000 --https-server 3001"
NTOP_OPTS="-u ntop -P /var/lib/ntop"

30
testing/ntop/ntop.initd Normal file
View File

@ -0,0 +1,30 @@
#!/sbin/runscript
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
depend() {
need net
}
checkconfig() {
if [ ! -e /var/lib/ntop/ntop_pw.db ]; then
eerror "You need to set a password first by running"
eerror "ntop --set-admin-password"
return 1
fi
}
start() {
checkconfig || return 1
ebegin "Starting ntop"
export LC_ALL=C # apparently doesn't work with some locales (#191576 and #205382)
export GDFONTPATH=/usr/share/fonts/corefonts # apparently the only font that works (#231705)
start-stop-daemon --start --exec /usr/bin/ntop -- -d -L ${NTOP_OPTS}
eend $?
}
stop() {
ebegin "Stopping ntop"
start-stop-daemon --stop --retry 30 --pidfile /var/run/ntop.pid
eend $?
}