# HG changeset patch # User Claudinei Pereira # Date 1299630012 0 # Node ID 7df33dda3d08865740b22376ef05d2139b3d2ac5 # Parent e1df651a683cb9997eef657d2c0aad895723ba1d couchdb: add pre and post remove functions diff -r e1df651a683c -r 7df33dda3d08 couchdb/receipt --- a/couchdb/receipt Wed Mar 09 00:02:19 2011 +0000 +++ b/couchdb/receipt Wed Mar 09 00:20:12 2011 +0000 @@ -65,8 +65,10 @@ echo "Processing post-install commands..." - grep -q "$PACKAGE" /etc/passwd || adduser -S -D -h $LIBDIR \ - -H -s /bin/sh -g "CouchDB Administrator" $PACKAGE + grep -q "$PACKAGE" /etc/group || addgroup -S $PACKAGE + + grep -q "$PACKAGE" /etc/passwd || adduser -S -D -H -h $LIBDIR \ + -G $PACKAGE -s /bin/sh -g "CouchDB Administrator" $PACKAGE for DIR in $LIBDIR $ETCDIR $LOGDIR $RUNDIR; do chown -R $PACKAGE:$PACKAGE $DIR && chmod -R 0770 $DIR @@ -74,3 +76,30 @@ echo "Done..." } + +# Pre and post remove commands for Tazpkg. +pre_remove() +{ + INIT_FILE="/etc/init.d/$PACKAGE" + echo "Processing pre-remove commands..." + [ -f $INIT_FILE ] && $INIT_FILE stop + echo "Done..." +} + +post_remove() +{ + LIBDIR="/var/lib/$PACKAGE" + ETCDIR="/etc/$PACKAGE" + LOGDIR="/var/log/$PACKAGE" + RUNDIR="/var/run/$PACKAGE" + + echo "Processing post-remove commands..." + + deluser $PACKAGE + + for DIR in $LIBDIR $ETCDIR $LOGDIR $RUNDIR; do + rm -rf $DIR + done + + echo "Done..." +}