wok rev 9178

couchdb: add pre and post remove functions
author Claudinei Pereira <claudinei@slitaz.org>
date Wed Mar 09 00:20:12 2011 +0000 (2011-03-09)
parents e1df651a683c
children 63809d155c57
files couchdb/receipt
line diff
     1.1 --- a/couchdb/receipt	Wed Mar 09 00:02:19 2011 +0000
     1.2 +++ b/couchdb/receipt	Wed Mar 09 00:20:12 2011 +0000
     1.3 @@ -65,8 +65,10 @@
     1.4  
     1.5  	echo "Processing post-install commands..."
     1.6  
     1.7 -	grep -q "$PACKAGE" /etc/passwd || adduser -S -D -h $LIBDIR \
     1.8 -		-H -s /bin/sh -g "CouchDB Administrator" $PACKAGE
     1.9 +	grep -q "$PACKAGE" /etc/group || addgroup -S $PACKAGE
    1.10 +
    1.11 +	grep -q "$PACKAGE" /etc/passwd || adduser -S -D -H -h $LIBDIR \
    1.12 +	        -G $PACKAGE -s /bin/sh -g "CouchDB Administrator" $PACKAGE
    1.13  
    1.14  	for DIR in $LIBDIR $ETCDIR $LOGDIR $RUNDIR; do
    1.15  		chown -R $PACKAGE:$PACKAGE $DIR && chmod -R 0770 $DIR
    1.16 @@ -74,3 +76,30 @@
    1.17  
    1.18  	echo "Done..."
    1.19  }
    1.20 +
    1.21 +# Pre and post remove commands for Tazpkg.
    1.22 +pre_remove()
    1.23 +{
    1.24 +	INIT_FILE="/etc/init.d/$PACKAGE"
    1.25 +	echo "Processing pre-remove commands..."
    1.26 +	[ -f $INIT_FILE ] && $INIT_FILE stop
    1.27 +	echo "Done..."
    1.28 +}
    1.29 +
    1.30 +post_remove()
    1.31 +{
    1.32 +	LIBDIR="/var/lib/$PACKAGE"
    1.33 +	ETCDIR="/etc/$PACKAGE"
    1.34 +	LOGDIR="/var/log/$PACKAGE"
    1.35 +	RUNDIR="/var/run/$PACKAGE"
    1.36 +
    1.37 +	echo "Processing post-remove commands..."
    1.38 +
    1.39 +	deluser $PACKAGE
    1.40 +
    1.41 +	for DIR in $LIBDIR $ETCDIR $LOGDIR $RUNDIR; do
    1.42 +		rm -rf $DIR
    1.43 +	done
    1.44 +
    1.45 +	echo "Done..."
    1.46 +}