#!/bin/sh
# rpm helper scriptlet to remove a syslog entry (sysklogd and syslog-ng)
# $Id$


del_rsyslog_entry() {
    package=$1

    file="/etc/rsyslog.d/$package.conf";

    # check the file exists
    if [ ! -f $file ]; then
        return
    fi

    # check the file is the one created by package installation
    line=$(head -1 $file)
    
    echo $line
    if [ "$line" != "# Automatically added by $package installation" ]; then
      return
    fi

    /bin/rm -f $file

    service rsyslog condrestart 2>&1 >/dev/null;
}


if [ $# -lt 2 ]; then
    echo "usage: $0 <pkg> <nb>"
    exit 1
fi

package=$1
number=$2

# don't do anything for upgrade
if [ $number -eq 1 ]; then
   exit 0
fi

del_rsyslog_entry $package



