summaryrefslogtreecommitdiffstats
path: root/net/ntpa/pkg-deinstall
blob: 9de39eba00f9603478d034af0a28aff2bd1109ef (plain)
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
#! /bin/sh

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

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


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