aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils/munin-node/pkg-deinstall
blob: 66cf3949ad7862e10e1ec8a9f2910067f059299b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#! /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