#!/bin/sh
# helper script to help removing a mail alias file to system MTA
if [ $# != 3 ]; then
echo "usage: $0 <pkg name> <number installed> <file>" 1>&2
exit 1
fi
pkg=$1 # name of the package
num=$2 # number of packages installed
file=$3 # alias file to add
# only needed for uninstallation
if [ $num = 0 ]; then
# check mta
mta="`readlink /etc/alternatives/sendmail-command 2>/dev/null | cut -d . -f 2`"
if [ "$mta" == "postfix" ]; then
maps=`/usr/sbin/postconf -h alias_maps | sed -e 's|, hash:$file||'`
database=`/usr/sbin/postconf -h alias_database | sed -e 's|, hash:$file||'`
postconf -e \
"alias_maps = $maps" \
"alias_database = $database"
else
sed -i \
-e '/^# added by $pkg rpm/d' \
-e '/^:include:$file$/d' \
/etc/aliases
fi
newaliases
fi