wok diff c_icap/receipt @ rev 11941

c_icap: Add initscript & fix configfile
author Eric Joseph-Alexandre <erjo@slitaz.org>
date Thu Mar 01 07:01:35 2012 +0100 (2012-03-01)
parents 055d964cbc4c
children 2142911d2464
line diff
     1.1 --- a/c_icap/receipt	Tue Feb 28 22:00:15 2012 +0100
     1.2 +++ b/c_icap/receipt	Thu Mar 01 07:01:35 2012 +0100
     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 +}