aboutsummaryrefslogblamecommitdiff
path: root/sysutils/munin-node/pkg-deinstall
blob: 66cf3949ad7862e10e1ec8a9f2910067f059299b (plain) (tree)
1
2
3
4
5
6
7
8
9
10
          
 
                
                                               
 

                              


      

                            
                                                                                        




                                    

                                                                                                                      



                                        


                                                                                    


      
 

              
                                             


                            

                   

          
#! /bin/sh

stop_process() {
    STARTSTOP=${PKG_PREFIX}/etc/rc.d/munin-node

    if [ -x $STARTSTOP ]; then
	$STARTSTOP stop
    fi
}

delnewsyslog() {
    tmp="/etc/#munin-node$$"
    sed -e '/^\/var\/log\/munin\/munin-node.log[ 	]/d' /etc/newsyslog.conf >${tmp}
    cat ${tmp} > /etc/newsyslog.conf
    rm ${tmp}
}

newsyslog() {
    ENTRY=`grep /var/log/munin/munin-node.log /etc/newsyslog.conf`
    DEFAULT='/var/log/munin/munin-node.log			644  7	   *	@T00  Z	/var/run/munin/munin-node.pid'
    if [ -z "$ENTRY" ]; then
	exit 0
    elif [ "$ENTRY" = "$DEFAULT" ]; then
	delnewsyslog
    else
    echo "You have changed the default munin-node entry in \"/etc/newsyslog.conf\"".
    echo "If you deinstall munin-node permanently, you have to manually remove it"
    fi
}


case $2 in
    DEINSTALL)
	if [ -z "${PACKAGE_BUILDING}" ]; then
		stop_process
		newsyslog
	fi
	;;
    POST-DEINSTALL)
	;;
esac