Receipt for: ntop
source
stuff/etc/init.d/ntop
PACKAGE="ntop"
VERSION="4.1.0"
CATEGORY="network"
SHORT_DESC="Network traffic probe."
MAINTAINER="pascal.bellard@slitaz.org"
LICENSE="GPL3"
TARBALL="$PACKAGE-$VERSION.tar.gz"
WEB_SITE="https://www.ntop.org/"
WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
CONFIG_FILES="/etc/ntop"
TAGS="network"
DEPENDS="zlib openssl libpng libpcap glibc gdbm rrdtool perl pcre geoip \
libwrap"
BUILD_DEPENDS="zlib-dev openssl-dev libpng-dev libpcap-dev libtool \
glibc-dev gdbm-dev rrdtool autoconf automake rrdtool-dev wget geoip-dev \
libwrap libtool"
current_version()
{
wget -O - https://sourceforge.net/projects/$PACKAGE/files/$PACKAGE 2>/dev/null | \
sed "/$PACKAGE-/!d;/tar/!d;s|.*$PACKAGE-\\(.*\\).tar.*\".*|\\1|;q"
}
compile_rules()
{
grep -rl -- -flat_namespace * | xargs sed -i 's|-flat_namespace||'
./autogen.sh --prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var/lib \
$CONFIGURE_ARGS 2>&1 | grep -v 'grep: libtool:' &&
make && make install
#~ && make install-data-as
}
genpkg_rules()
{
mkdir -p $fs/usr/lib/plugins \
$fs/usr/share \
$fs/var/log/ntop
cp -a $install/usr/lib/*.so* $fs/usr/lib
cp -a $install/usr/lib/ntop $fs/usr/lib
cp -a $install/usr/bin $fs/usr
cp -a $install/usr/share/ntop $fs/usr/share
chown -R www:www $fs/usr/share/ntop
cp -a $install/usr/bin $fs
cp -a $install/etc $fs
cp -a $install/var $fs
# Copy startup script and fix perms
cp -a stuff/etc $fs
chown root:root $fs/etc/init.d/ntop
}
post_install()
{
user=ntop
group=ntop
if ! grep -q $user: "$1/etc/passwd"; then
echo -n "Adding user/group $user..."
chroot "$1/" addgroup -S $user
chroot "$1/" adduser -S -D -H -G $group $user
status
fi
# Fix perms for files and directories
chroot "$1/" chown -R ${user}:${group} /var/lib/ntop /var/log/ntop
# Start package daemon if we are on running system
[ "$1" ] || /etc/init.d/$PACKAGE start
# post_install messges
echo -e "\nTo starts $PACKAGE server you can run :\n"
echo "/etc/init.d/$PACKAGE start"
echo -e "Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf\n"
}
pre_remove()
{
[ "$1" ] || /etc/init.d/$PACKAGE stop
}
post_remove()
{
user=ntop
group=ntop
if ! grep -q $user: "$1/etc/passwd"; then
echo -n "Removing user/group $user..."
chroot "$1/" delgroup $user
chroot "$1/" deluser $user
status
fi
}