wok rev 11943

merge
author Samuel Trassare <samuel_trassare@yahoo.com>
date Wed Feb 29 22:02:22 2012 -0800 (2012-02-29)
parents 85543915e825 95e0d6cca290
children e58116e4a58f
files
line diff
     1.1 --- a/c_icap/receipt	Wed Feb 29 22:00:25 2012 -0800
     1.2 +++ b/c_icap/receipt	Wed Feb 29 22:02:22 2012 -0800
     1.3 @@ -23,14 +23,53 @@
     1.4  # Rules to gen a SliTaz package suitable for Tazpkg.
     1.5  genpkg_rules()
     1.6  {
     1.7 -	mkdir -p $fs/usr/lib/$PACKAGE
     1.8 -	
     1.9 +	mkdir -p $fs/usr/lib/$PACKAGE \
    1.10 +		$fs/etc/init.d
    1.11 +				
    1.12  	cp -a $install/usr/bin $fs/usr
    1.13  	cp -a $install/usr/lib/*.so* $fs/usr/lib
    1.14  	cp -a $install/usr/lib/$PACKAGE/*.so* $fs/usr/lib/$PACKAGE
    1.15  	
    1.16  	cp -pa $install/etc $fs/
    1.17 +	cp -pa $stuff/c-icapd $fs/etc/init.d
    1.18  	
    1.19  	# Cleanup
    1.20  	rm -f $fs/usr/bin/c-icap-config
    1.21 +	
    1.22 +	# Fix config file
    1.23 +	sed -i -e "s|YourServerName|localhost|" \
    1.24 +		-e "s|/usr/var/log/|/var/log/c-icap|" \
    1.25 +		-e "s|/usr/etc|/etc/c-icap|" $fs/etc/c-icap/c-icap.conf
    1.26 +	chmod -x $fs/etc/c-icap/*
    1.27 +		
    1.28  }
    1.29 +
    1.30 +post_install()
    1.31 +{
    1.32 +	[ -z $1 ] && /etc/init.d/c-icapd start
    1.33 +			
    1.34 +	cat <<EOF
    1.35 +	
    1.36 +----
    1.37 +To start $PACKAGE server you can run :
    1.38 +
    1.39 +    /etc/init.d/$PACKAGE start
    1.40 +
    1.41 +Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
    1.42 +----
    1.43 +EOF
    1.44 +}
    1.45 +
    1.46 +pre_remove(){
    1.47 +		
    1.48 +		echo "Stopping daemon..."
    1.49 +		if (ps | grep -q c-icap); then
    1.50 +			/etc/init.d/c-icapd stop
    1.51 +		fi
    1.52 +}
    1.53 +post_remove()
    1.54 +{
    1.55 +	echo "Removing stalled files..."
    1.56 +	test -d /var/log/c-icap && rm -rf /var/log/c-icap
    1.57 +	test -d /usr/run/c-icap && rm -rf /usr/run/c-icap
    1.58 +}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/c_icap/stuff/c-icapd	Wed Feb 29 22:02:22 2012 -0800
     2.3 @@ -0,0 +1,57 @@
     2.4 +#!/bin/sh
     2.5 +# /etc/init.d/nagios : Start, stop and restart ICAP server on SliTaz, at 
     2.6 +# boot time or with the command line.
     2.7 +#
     2.8 +# To start ICAP server at boot time, just put c-icapd in the $RUN_DAEMONS
     2.9 +# variable of /etc/rcS.conf and configure options with /etc/daemons.conf
    2.10 +#
    2.11 +. /etc/init.d/rc.functions
    2.12 +. /etc/daemons.conf
    2.13 +
    2.14 +NAME=c-icap
    2.15 +DESC="ICAP Server"
    2.16 +DAEMON=/usr/bin/c-icap
    2.17 +OPTIONS=""
    2.18 +PIDFILE=/var/run/c-icap/c-icap.pid
    2.19 +
    2.20 +case "$1" in
    2.21 +  start)
    2.22 +    if active_pidfile $PIDFILE $NAME ; then
    2.23 +      echo "$NAME already running."
    2.24 +      exit 1
    2.25 +    fi
    2.26 +    echo -n "Starting $DESC: $NAME... "
    2.27 +	$DAEMON $OPTIONS
    2.28 +    status
    2.29 +    ;;
    2.30 +  stop)
    2.31 +    if ! active_pidfile $PIDFILE $NAME ; then
    2.32 +      echo "$NAME is not running."
    2.33 +      exit 1
    2.34 +    fi
    2.35 +    echo -n "Stopping $DESC: $NAME... "
    2.36 +    kill `cat $PIDFILE`
    2.37 +    status
    2.38 +    ;;
    2.39 +  restart|reload)
    2.40 +    if ! active_pidfile $PIDFILE $NAME ; then
    2.41 +      echo "$NAME is not running."
    2.42 +      exit 1
    2.43 +    fi
    2.44 +    echo -n "Restarting $DESC: $NAME... "
    2.45 +    kill `cat $PIDFILE`
    2.46 +    sleep 2
    2.47 +    $DAEMON $OPTIONS
    2.48 +    status
    2.49 +    ;;
    2.50 +  test)
    2.51 +	configtest ;;
    2.52 +  *)
    2.53 +    echo ""
    2.54 +    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart|reload]"
    2.55 +    echo ""
    2.56 +    exit 1
    2.57 +    ;;
    2.58 +esac
    2.59 +
    2.60 +exit 0