wok-stable rev 10890
ntop: improve receipt
author | Eric Joseph-Alexandre <erjo@slitaz.org> |
---|---|
date | Tue Jul 05 15:39:47 2011 +0200 (2011-07-05) |
parents | f8f2b572363d |
children | 9bd8026efd2d |
files | ntop/receipt ntop/stuff/etc/init.d/ntop |
line diff
1.1 --- a/ntop/receipt Tue Jul 05 01:19:06 2011 +0200 1.2 +++ b/ntop/receipt Tue Jul 05 15:39:47 2011 +0200 1.3 @@ -21,7 +21,7 @@ 1.4 cd $src 1.5 ./autogen.sh --prefix=/usr \ 1.6 --sysconfdir=/etc \ 1.7 - --localstatedir=/var $CONFIGURE_ARGS && 1.8 + --localstatedir=/var/lib $CONFIGURE_ARGS && 1.9 make && 1.10 make DESTDIR=$PWD/_pkg install 1.11 #~ && make install-data-as 1.12 @@ -30,19 +30,19 @@ 1.13 # Rules to gen a SliTaz package suitable for Tazpkg. 1.14 genpkg_rules() 1.15 { 1.16 - mkdir -p $fs/usr/lib/plugins $fs/usr/share 1.17 + mkdir -p $fs/usr/lib/plugins \ 1.18 + $fs/usr/share \ 1.19 + $fs/var/log/ntop 1.20 + 1.21 cp -a $_pkg/usr/lib/*.so* $fs/usr/lib 1.22 cp -a $_pkg/usr/lib/ntop $fs/usr/lib 1.23 cp -a $_pkg/usr/bin $fs/usr 1.24 cp -a $_pkg/usr/share/ntop $fs/usr/share 1.25 - chown -R 80.80 $fs/usr/share/ntop 1.26 + chown -R www.www $fs/usr/share/ntop 1.27 cp -a $_pkg/usr/bin $fs 1.28 cp -a $_pkg/etc $fs 1.29 cp -a $_pkg/var $fs 1.30 1.31 - # fix perms for /var/ntop 1.32 - chown nobody.nogroup $fs/var/ntop 1.33 - 1.34 # Copy startup script and fix perms 1.35 cp -a stuff/etc $fs 1.36 chown root.root $fs/etc/init.d/ntop 1.37 @@ -56,8 +56,8 @@ 1.38 1.39 post_install() 1.40 { 1.41 - $user=ntop 1.42 - $group=ntop 1.43 + user=ntop 1.44 + group=ntop 1.45 1.46 if ! grep -q $user: $1/etc/passwd; then 1.47 echo -n "Adding user/group $user..." 1.48 @@ -67,9 +67,9 @@ 1.49 fi 1.50 1.51 # Fix perms for files and directories 1.52 - chroot $1/ chown -R ${user}.${group} /var/ntop 1.53 + chroot $1/ chown -R ${user}.${group} /var/lib/ntop /var/log/ntop 1.54 1.55 - # Start Nagios daemon if we are on running system 1.56 + # Start package daemon if we are on running system 1.57 [ -z $1 ] && /etc/init.d/$PACKAGE start 1.58 1.59 # post_install messges 1.60 @@ -78,5 +78,20 @@ 1.61 echo -e "Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf\n" 1.62 } 1.63 1.64 +pre_remove() 1.65 +{ 1.66 + [ -z $1 ] && /etc/init.d/$PACKAGE stop 1.67 +} 1.68 1.69 +post_remove() 1.70 +{ 1.71 + user=ntop 1.72 + group=ntop 1.73 1.74 + if ! grep -q $user: $1/etc/passwd; then 1.75 + echo -n "Removing user/group $user..." 1.76 + chroot $1/ delgroup $user 1.77 + chroot $1/ deluser $user 1.78 + status 1.79 + fi 1.80 +}
2.1 --- a/ntop/stuff/etc/init.d/ntop Tue Jul 05 01:19:06 2011 +0200 2.2 +++ b/ntop/stuff/etc/init.d/ntop Tue Jul 05 15:39:47 2011 +0200 2.3 @@ -13,10 +13,13 @@ 2.4 DAEMON=/usr/bin/ntop 2.5 2.6 HTTP_PORT="3000" 2.7 +NTOP_USER="ntop" 2.8 2.9 -OPTIONS="-w $HTTP_PORT -d" 2.10 +LOGFILE=/var/log/ntop/ntop.log 2.11 PIDFILE=/var/run/ntop.pid 2.12 2.13 +OPTIONS="-w $HTTP_PORT -L -u $NTOP_USER -d" 2.14 + 2.15 case "$1" in 2.16 start) 2.17 if [ -f $PIDFILE ] ; then 2.18 @@ -28,7 +31,7 @@ 2.19 ntop -A || exit 2.20 fi 2.21 echo -n "Starting $DESC: $NAME... " 2.22 - $DAEMON $OPTIONS 2.23 + $DAEMON $OPTIONS >> $LOGFILE 2.24 status 2.25 ;; 2.26 stop)