postinst is in amavisd-new 1:2.7.1-2ubuntu3.
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 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | #! /bin/sh
# postinst script for amavisd-new
# $Id: amavisd-new.postinst 908 2006-06-09 03:42:01Z hmh $
#
# see: dh_installdeb(1)
# debconf
set -e
. /usr/share/debconf/confmodule
# 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'.
case "$1" in
configure)
# add amavis system user and group (requires adduser >= 3.34)
# don't muck around with this unless you KNOW what you're doing
# also, don't attempt to second guess what kind of fucked up
# mistakes other amavis packages might have made. Tell the user
# to kill the bogus entry. We can't simply overwrite it with
# usermod, since that would certainly cause severe headaches for
# a sysadmin out there...
#
# I don't care that users migrating from other amavis packages
# will have extra work. Someone lost 30GB because we tried to
# be nice once. See #190414.
echo "Creating/updating amavis user account..." >&2
if ! getent group amavis > /dev/null ; then
addgroup --quiet --system amavis || {
# addgroup failed. Why?
if ! getent group amavis >/dev/null ; then
echo "Could not create system group amavis." >&2
exit 1
fi
# well, the group is there, so just ignore the error
}
fi
if ! getent passwd amavis > /dev/null ; then
adduser --system --ingroup amavis --home /var/lib/amavis \
--gecos "AMaViS system user" --shell /bin/sh \
--quiet --disabled-password amavis || {
# adduser failed. Why?
if getent passwd amavis >/dev/null ; then
echo "Non-system user amavis found. I will not overwrite a non-system" >&2
echo "user. Remove the user and reinstall amavisd-new." >&2
exit 1
fi
# unknown adduser error, simply exit
exit 1
}
fi
# Clean up after #190414
homedir=$(getent passwd amavis | cut -d : -f 6)
if [ "x${homedir}" = "x/" ] ; then
echo 'WARNING! Homedir of user amavis was set to "/", this is' >&2
echo 'extremely dangerous! Overriding it to /var/lib/amavis...' >&2
homedir=/var/lib/amavis
usermod -d "${homedir}" amavis
fi
# Sanity-checks (see #367807)
if [ ! -d "${homedir}" ] ; then
echo "Broken amavis system user found. To insure data-safety," >&2
echo "it is up to you the local administrator to remove the broken" >&2
echo "amavis user, or repair it so that it is sane" >&2
exit 1
fi
# in order to give all critical dirs sane permissions we first check
# if we have the packages standard permissions, if yes we delete them,
# if no we alert the admin.
for i in /var/lib/amavis:755:0750:amavis:amavis /var/lib/amavis/db:755:0750:amavis:amavis \
/var/lib/amavis/tmp:755:0770:amavis:amavis /var/lib/amavis/virusmails:755:0750:amavis:amavis
do
dir=$(echo $i | cut -d : -f 1)
perms_local=$(dpkg-statoverride --list "$dir" | awk '{print $4,$3,$1,$2}' | tr -s " " ":")
if [ "$perms_local" ] ; then
perms_old=$(echo $i | cut -d : -f 1,2,4,5)
perms_new=$(echo $i | cut -d : -f 1,3,4,5)
mode_others=$(dpkg-statoverride --list "$dir" | awk '{print $3}' | sed 's/.*\([0-9]\{1\}\)$/\1/')
if [ "$perms_local" = "$perms_old" ] ; then
dpkg-statoverride --remove "$dir"
elif [ "$perms_local" != "$perms_new" ] && [ "$mode_others" != "0" ] ; then
echo
echo "WARNING: $dir has set custom permissions which may be too open - please take a look at README.Debian!"
echo
fi
fi
done
umask 022
for i in /var/lib/amavis:0750 /var/lib/amavis/db:0750 /var/lib/amavis/tmp:0770 \
/var/lib/amavis/virusmails:0750 /var/run/amavis:0755
do
dir=$(echo $i | cut -d : -f 1)
perm=$(echo $i | cut -d : -f 2)
if [ ! -d "$dir" ] ; then
mkdir -p "$dir"
fi
if ! dpkg-statoverride --list "$dir" > /dev/null ; then
dpkg-statoverride --update --add amavis amavis "$perm" "$dir"
fi
done
#
# Conffile upgrade handling
#
# from sarge amavisd-new (1.0) and previous
# disable the config file, initscript will refuse to run
db_fset amavisd-new/outdated_config_style_warning seen false || true
for i in /etc/amavisd.conf /etc/amavis/amavisd.conf ; do
if [ -e "$i" ] ; then
mv "$i" "${i}.disabled" || true
db_input high amavisd-new/outdated_config_style_warning || true
db_go || true
fi
done
# Work around dpkg not deleting removed conffiles
# (template directories (with files) removed in 1:2.3.3-2)
if dpkg --compare-versions "1:2.3.3-2" gt-nl "$2" ; then
for i in pt_BR fr it_IT de_DE ; do
if [ -e "/etc/amavis/$i" ] ; then
echo "Moving outdated l10n template to /etc/amavis/${i}.outdated_for_2.3.3-2" >&2
mv "/etc/amavis/$i" "/etc/amavis/${i}.outdated_for_2.3.3-2"
fi
done
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# We don't need debconf anymore from here on
db_stop
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
init_failed ()
{
echo "WARNING: Starting amavisd-new failed. Please check your configuration."
}
# Automatically added by dh_installinit
if [ -x "/etc/init.d/amavis" ]; then
if [ ! -e "/etc/init/amavis.conf" ]; then
update-rc.d amavis defaults 19 21 >/dev/null
fi
invoke-rc.d amavis start || init_failed
fi
# End automatically added section
exit 0
|