# HG changeset patch # User Eric Joseph-Alexandre # Date 1309873187 -7200 # Node ID c3f9dd585ee1fea2fc286d4d6d7d214b36f44f7a # Parent f8f2b572363da905886bb31b815ac3cafea71287 ntop: improve receipt diff -r f8f2b572363d -r c3f9dd585ee1 ntop/receipt --- a/ntop/receipt Tue Jul 05 01:19:06 2011 +0200 +++ b/ntop/receipt Tue Jul 05 15:39:47 2011 +0200 @@ -21,7 +21,7 @@ cd $src ./autogen.sh --prefix=/usr \ --sysconfdir=/etc \ - --localstatedir=/var $CONFIGURE_ARGS && + --localstatedir=/var/lib $CONFIGURE_ARGS && make && make DESTDIR=$PWD/_pkg install #~ && make install-data-as @@ -30,19 +30,19 @@ # Rules to gen a SliTaz package suitable for Tazpkg. genpkg_rules() { - mkdir -p $fs/usr/lib/plugins $fs/usr/share + mkdir -p $fs/usr/lib/plugins \ + $fs/usr/share \ + $fs/var/log/ntop + cp -a $_pkg/usr/lib/*.so* $fs/usr/lib cp -a $_pkg/usr/lib/ntop $fs/usr/lib cp -a $_pkg/usr/bin $fs/usr cp -a $_pkg/usr/share/ntop $fs/usr/share - chown -R 80.80 $fs/usr/share/ntop + chown -R www.www $fs/usr/share/ntop cp -a $_pkg/usr/bin $fs cp -a $_pkg/etc $fs cp -a $_pkg/var $fs - # fix perms for /var/ntop - chown nobody.nogroup $fs/var/ntop - # Copy startup script and fix perms cp -a stuff/etc $fs chown root.root $fs/etc/init.d/ntop @@ -56,8 +56,8 @@ post_install() { - $user=ntop - $group=ntop + user=ntop + group=ntop if ! grep -q $user: $1/etc/passwd; then echo -n "Adding user/group $user..." @@ -67,9 +67,9 @@ fi # Fix perms for files and directories - chroot $1/ chown -R ${user}.${group} /var/ntop + chroot $1/ chown -R ${user}.${group} /var/lib/ntop /var/log/ntop - # Start Nagios daemon if we are on running system + # Start package daemon if we are on running system [ -z $1 ] && /etc/init.d/$PACKAGE start # post_install messges @@ -78,5 +78,20 @@ echo -e "Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf\n" } +pre_remove() +{ + [ -z $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 +} diff -r f8f2b572363d -r c3f9dd585ee1 ntop/stuff/etc/init.d/ntop --- a/ntop/stuff/etc/init.d/ntop Tue Jul 05 01:19:06 2011 +0200 +++ b/ntop/stuff/etc/init.d/ntop Tue Jul 05 15:39:47 2011 +0200 @@ -13,10 +13,13 @@ DAEMON=/usr/bin/ntop HTTP_PORT="3000" +NTOP_USER="ntop" -OPTIONS="-w $HTTP_PORT -d" +LOGFILE=/var/log/ntop/ntop.log PIDFILE=/var/run/ntop.pid +OPTIONS="-w $HTTP_PORT -L -u $NTOP_USER -d" + case "$1" in start) if [ -f $PIDFILE ] ; then @@ -28,7 +31,7 @@ ntop -A || exit fi echo -n "Starting $DESC: $NAME... " - $DAEMON $OPTIONS + $DAEMON $OPTIONS >> $LOGFILE status ;; stop)