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 182 183
|
#!/bin/sh -e
# Function to prompt user to press return (to ensure they have read
# an important message), but only on interactive installs
press_return() {
if [ "$DEBIAN_FRONTEND" != "noninteractive" ]; then
read -p "* Press return to continue" foo
fi
}
if [ "$DEBIAN_FRONTEND" ]; then
# Should be case insensitive, convert to lower case
DEBIAN_FRONTEND=`echo "$DEBIAN_FRONTEND" | tr A-Z a-z`
fi
case "$1" in
configure)
# Create directories for log etc
if [ ! -d /var/log/exim ]; then
install -d -omail -gadm -m2750 /var/log/exim
fi
install -d -omail -gmail /var/run/exim
# Remove /usr/doc symlink
if [ -d /usr/doc -a -h /usr/doc/exim -a -d /usr/share/doc/exim ]; then
rm -f /usr/doc/exim
fi
# If we're upgrading from woody version, or this is a new installation,
# display message suggesting upgrade to exim4
if [ ! $2 ] || dpkg --compare-versions $2 lt 3.36-1; then
cat <<EOM
exim 3.x and 4.x
================
This is a package of exim 3.x. This is no longer supported upstream, and only
remains in debian to support users with existing exim 3 installations. We strongly
reccommend exim 4.x (which is in the exim4 package) for new installations. We
suggest users with existing exim 3 installations consider upgrading, particularly
if they have fairly simple configurations.
EOM
press_return
fi
# Configure exim
if [ ! -f /etc/exim/exim.conf ]; then
if [ "$DEBIAN_FRONTEND" != "noninteractive" ]; then
/usr/sbin/eximconfig $*
fi
fi
# Remove smail from inetd.conf in case it hasn't done so properly
if [ -x /usr/sbin/update-inetd ]; then
update-inetd --remove in.smtpd
fi
# If there is a "root: root" line in aliases, delete it
if [ -f /etc/aliases ]; then
if grep -q "^root: root$" /etc/aliases; then
echo "Removing duplicate root alias."
grep -v "^root: root$" /etc/aliases >/etc/aliases.new
mv -f /etc/aliases.new /etc/aliases
fi
fi
# Ensure databases have correct owner and are up to date
if [ -d /var/spool/exim/db ]; then
chown -f mail.mail /var/spool/exim/db/* || true
db3_upgrade /var/spool/exim/db/* || true
fi
# If we're upgrading from an older version than 3.16-5, and so are
# using libdb 1.85 for databases
if [ $2 ] && dpkg --compare-versions $2 lt 3.16-5; then
# Check whether any other databases are used
if [ -f /etc/exim/exim.conf ]; then
if grep -q "dbm" /etc/exim/exim.conf; then
cat <<EOM
New libdb version
=================
This version of exim uses libdb2 databases. The version you are
upgrading from used libdb 1.85. Unfortunately the files are not
compatible. The hints databases have been updated, which should not
cause any problems, however it looks like your configuration file
refers to some other database files. If this is indeed the case, you
should rebuild them as libdb2 databases.
EOM
press_return
fi
fi
fi
# If we're upgrading from an older version than 3.03-2 and not enabled
# in /etc/inetd.conf
if [ "$2" ] && dpkg --compare-versions $2 lt 3.03-2 &&
! grep -q "^#<off># *smtp" /etc/inetd.conf; then
# Give a warning
cat <<EOM
This may be important
=====================
In the version of exim you are upgrading from, the startup script
(/etc/init.d/exim) was set up by default to not run exim. In the new one,
it will run exim as a daemon if you are not running exim from inetd, and
you appear not to be.
If you have edited your startup script then you can ignore this message.
Otherwise, if you do not want to run exim as a daemon, you will need to edit
the startup script.
EOM
press_return
fi
# If we're upgrading from a pre-3.00 version, and it was configured
if [ $2 ] && dpkg --compare-versions $2 lt 3.00-1 &&
[ -f /etc/exim/exim.conf ] ; then
# Rename old file and convert
mv /etc/exim/exim.conf /etc/exim/exim.conf-pre-v3
/usr/sbin/exim-upgrade-to-r3 </etc/exim/exim.conf-pre-v3 \
>/etc/exim/exim.conf 2>/dev/null
# Print warning message
cat <<EOM
Important! Exim configuration file format has changed!
======================================================
Your old configuration file has been renamed to /etc/exim/exim.conf-pre-v3.
An automatic conversion script has been used to write a new
/etc/exim/exim.conf for you.
However, this does not fix everything, and you should check it is OK.
Because a wrongly configured mailer can cause serious problems, exim
is now disabled! When you want to re-enable it, you should do
"eximconfig -i".
Please read /usr/share/doc/exim/README.UPDATING.gz for more information.
EOM
press_return
else
# OK to start exim running again
# If configured
if [ -f /etc/exim/exim.conf ]; then
# Install us in inetd
if [ -x /usr/sbin/update-inetd ]; then
# Is this an upgrade
if [ $2 ]; then
update-inetd --comment-chars \#disabled\# --enable smtp
else
update-inetd --group MAIL --comment-chars \#disabled\# --add \
"smtp stream tcp nowait mail /usr/sbin/exim exim -bs"
fi
fi
# Install in init.d
update-rc.d exim defaults >/dev/null
# Start running exim (maybe)
#/etc/init.d/exim start || true
if which invoke-rc.d >/dev/null 2>&1; then
invoke-rc.d exim start
else
/etc/init.d/exim start
fi
fi
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
# Restart exim
#/etc/init.d/exim start || true
if which invoke-rc.d >/dev/null 2>&1; then
invoke-rc.d exim start
else
/etc/init.d/exim start
fi
;;
esac
|