postinst is in mimedefang 2.75-1.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | #! /bin/sh
# postinst script for mimedefang
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
#
# quoting from the policy:
# Any necessary prompting should almost always be confined to the
# post-installation script, and should be protected with a conditional
# so that unnecessary prompting doesn't happen if a package's
# installation fails and the `postinst' is called with `abort-upgrade',
# `abort-remove' or `abort-deconfigure'.
set_value() {
CONFFILE=$1
KEY=$2
VALUE=$3
TEMPFILE=$1.$$
if [ -e $CONFFILE ]; then
sed s/.*$2=.*/$2=$3/ $CONFFILE > $TEMPFILE
if ! diff $CONFFILE $TEMPFILE > /dev/null; then
mv $TEMPFILE $CONFFILE
else
rm $TEMPFILE
fi
else
touch $1
fi
if ! grep "^$2=$3" $1 2>&1 >/dev/null; then
echo "$2=$3" >> $1
fi
}
. /usr/share/debconf/confmodule
case "$1" in
configure)
# If existing user defang is still in group nogroup remove it
if [ `id -g defang 2> /dev/null`x = 65534x ]; then
deluser --quiet defang
fi
# Add defang group if not already present
addgroup --quiet --system defang > /dev/null 2>&1 || true
# Create user defang in group defang
if ! id -u defang >/dev/null 2>&1; then
adduser --quiet --system --ingroup defang --home /var/spool/MIMEDefang --no-create-home defang
fi
# Add User smmsp to group defang
if id -u smmsp >/dev/null 2>&1; then
adduser --quiet smmsp defang
fi
# Create spool directory
if [ ! -e /var/spool/MIMEDefang ]
then
mkdir -p /var/spool/MIMEDefang
fi
chmod 750 /var/spool/MIMEDefang
chown defang:defang /var/spool/MIMEDefang
mkdir -p /var/spool/MIMEDefang/.spamassassin
chmod 700 /var/spool/MIMEDefang/.spamassassin
chown defang /var/spool/MIMEDefang/.spamassassin
if [ -f /etc/sa-mimedefang.cf ]
then
echo "removing conffile /etc/sa-mimedefang.cf because of wrong location"
rm -f /etc/sa-mimedefang.cf
fi
if [ -f /etc/mail/mimedefang.conf ]
then
echo "removing conffile /etc/mail/mimedefang.conf because of wrong location"
rm -f /etc/mail/mimedefang.conf
fi
# Setup embeded perl
CONFFILE=/etc/default/mimedefang
# Copy file if it doesn't exist
if [ ! -e $CONFFILE ]; then
cp /usr/share/mimedefang/mimedefang.conf $CONFFILE
fi
db_get mimedefang/embedperl || true
if [ "$RET" = 'true' ]; then
set_value $CONFFILE MX_EMBED_PERL yes
else
set_value $CONFFILE MX_EMBED_PERL no
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
# Automatically added by dh_installinit
if [ -x "/etc/init.d/mimedefang" ]; then
update-rc.d mimedefang defaults >/dev/null
invoke-rc.d mimedefang start || exit $?
fi
# End automatically added section
exit 0
|