postinst is in sendmail-bin 8.14.4-4.1ubuntu1.
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 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | #!/bin/sh -e
#
# Debian post installation script
#
# Install of already installed package:
# 1) old-prerm upgrade new-version
# *) new-prerm failed-upgrade old-version
# *) old-postinst abort-upgrade new-version
#
# If a `conflicting' package is being removed at the same time:
# 1) forall packages depending on conflicting package and --auto-deconfigure
# deconfigured's-prerm deconfigure \
# in-favour package-being-installed version \
# removing conflicting-package version
# *) deconfigured's-postinst abort-deconfigure \
# in-favour package-being-installed-but-failed version \
# removing conflicting-package version
# 2) To prepare for removal of the conflicting package
# conflictor's-prerm remove \
# in-favour package new-version
# *) conflictor's-postinst abort-remove \
# in-favour package new-version
#
# Configuration of package:
# postinst configure most-recently-configured-version
#
set -e;
PACKAGE=sendmail-bin;
#-----------------------------------------------------------
#stop(): stop sendmail
stop_mta () {
# Account for varying PIDfile locations of older sendmail packages
if [ -f /var/run/sendmail/mta/sendmail.pid ]; then
start-stop-daemon --stop --oknodo --quiet \
--pidfile /var/run/sendmail/msp/sendmail.pid > /dev/null;
start-stop-daemon --stop --oknodo --quiet \
-pidfile /var/run/sendmail/mta/sendmail.pid > /dev/null;
elif [ -f /var/run/sendmail/sendmail.pid ]; then
start-stop-daemon --stop --oknodo --quiet \
--pidfile /var/run/sendmail/sendmail.pid > /dev/null;
elif [ -f /var/run/sendmail.pid ]; then
start-stop-daemon --stop --oknodo --quiet \
--pidfile /var/run/sendmail.pid > /dev/null;
fi;
# Since we changed the executable, do one more try - using the old name
if [ -f /var/run/sendmail/mta/sendmail.pid ]; then
start-stop-daemon --stop --oknodo --quiet \
--pidfile /var/run/sendmail/mta/sendmail.pid > /dev/null;
fi;
start-stop-daemon --stop --oknodo --quiet \
--name sendmail > /dev/null;
if [ -x /etc/init.d/sendmail ]; then
if [ -x /usr/sbin/invoke-rc.d ]; then
/usr/sbin/invoke-rc.d --quiet --force sendmail stop;
else
/etc/init.d/sendmail stop;
fi;
fi;
};
#-----------------------------------------------------------
#start(): start sendmail
start_mta () {
if [ -x /usr/sbin/invoke-rc.d ]; then
/usr/sbin/invoke-rc.d sendmail start;
else
/etc/init.d/sendmail start;
fi;
};
#-----------------------------------------------------------
# configure(): save sendmail.cf, call sendmailconfig
configure_mta () {
local enter;
echo -n "Configure now ? (y/N) ";
read yn;
yn=$(echo -n "$yn" | sed -e "s/^\ *//" -e "s/^\t*//");
test -n "$yn" || yn="N";
case "$yn" in
[Yy]*)
stop_mta;
/usr/sbin/sendmailconfig --no-reload;
start_mta;
;;
[Nn]*)
echo '';
echo "To configure sendmail later, type" \
"sendmailconfig";
echo "After configuring sendmail, you can" \
"start it via /etc/init.d/sendmail start";
echo -n "Press [ENTER] ";
read enter;
;;
esac;
};
# do we have debconf?
if [ -f /usr/share/debconf/confmodule ]; then
DEBCONF=true;
#. /usr/share/debconf/confmodule;
#db_stop; # For testing
else
DEBCONF='';
fi;
case "$1" in
configure)
# continue below
;;
abort-upgrade|abort-remove|abort-deconfigure)
exit 0;
;;
*)
echo "$PACKAGE postinst called with unknown argument \`$1'" >&2;
exit 1;
;;
esac;
#--------------------------------------------------------------------
# Continuation of "$1" = "configure"
# Note: can't use debhelper here because the actions aren't contiguous
#xxxHELPER#
# Automatically added by dh_installinit
if [ -x "/etc/init.d/sendmail" ]; then
update-rc.d -f sendmail remove >/dev/null;
update-rc.d sendmail defaults 21 19 >/dev/null;
#/etc/init.d/sendmail start
fi
# End automatically added section
#-----------------------------------------------------------
# Create (or update) MTA, MSP alternatives
# This way, we'll be able to install 2 MTAs on the same box :)
update-alternatives \
--install /usr/sbin/sendmail-mta sendmail-mta /usr/lib/sm.bin/sendmail 25 \
--slave /usr/share/man/man8/sendmail-mta.8.gz sendmail-mta.8.gz \
/usr/share/man/man8/sendmail.sendmail.8.gz \
--slave /usr/sbin/runq runq /usr/share/sendmail/runq \
--slave /usr/share/man/man8/runq.8.gz runq.8.gz \
/usr/share/man/man8/runq.sendmail.8.gz \
--slave /usr/sbin/newaliases newaliases \
/usr/share/sendmail/newaliases \
--slave /usr/share/man/man8/newaliases.8.gz newaliases.8.gz \
/usr/share/man/man8/newaliases.sendmail.8.gz \
--slave /usr/bin/mailq mailq /usr/share/sendmail/mailq \
--slave /usr/share/man/man1/mailq.1.gz mailq.1.gz \
/usr/share/man/man1/mailq.sendmail.1.gz \
--slave /usr/share/man/man5/aliases.5.gz aliases.5.gz \
/usr/share/man/man5/aliases.sendmail.5.gz \
;
update-alternatives \
--install /usr/sbin/sendmail-msp sendmail-msp /usr/lib/sm.bin/sendmail 25 \
--slave /usr/share/man/man8/sendmail-msp.8.gz sendmail-msp.8.gz \
/usr/share/man/man8/sendmail.sendmail.8.gz \
--slave /usr/sbin/sendmail sendmail /usr/lib/sm.bin/sendmail \
--slave /usr/lib/sendmail lib.sendmail /usr/lib/sm.bin/sendmail \
--slave /usr/share/man/man8/sendmail.8.gz sendmail.8.gz \
/usr/share/man/man8/sendmail.sendmail.8.gz \
;
#-----------------------------------------------------------
# With a dynamic uid/gid, have to set appropriate ownership herein
if command -v suidregister >/dev/null 2>&1 && test -s /etc/suid.conf; then
suidregister -s sendmail /usr/sbin/sendmail root smmsp 02755;
suidregister -s sendmail /usr/lib/sm.bin/mailstats root smmsp 02755;
elif [ -x /usr/sbin/sendmail ]; then
chown root:smmsp /usr/lib/sm.bin/sendmail;
chmod 02755 /usr/lib/sm.bin/sendmail;
chown root:smmsp /usr/lib/sm.bin/mailstats;
chmod 02755 /usr/lib/sm.bin/mailstats;
fi;
#-----------------------------------------------------------
# Create backups of /etc/mail/{sendmail,submit}.mc
if [ -f /etc/mail/sendmail.cf ]; then
echo "Saving old /etc/mail/sendmail.cf" \
"as /etc/mail/sendmail.cf.old ...";
cp -f /etc/mail/sendmail.cf \
/etc/mail/sendmail.cf.old;
chown root:root /etc/mail/sendmail.cf.old;
chmod 0644 /etc/mail/sendmail.cf.old;
fi;
if [ -f /etc/mail/submit.cf ]; then
cp -f /etc/mail/submit.cf \
/etc/mail/submit.cf.old;
chown root:root /etc/mail/submit.cf.old;
chmod 0644 /etc/mail/submit.cf.old;
fi;
start_ask=0;
#-----------------------------------------------------------
# Create /etc/mail/sendmail.mc if it doesn't exist
if [ ! -f /etc/mail/sendmail.mc ]; then
cat <<-EOT
You are doing a new install, or have erased /etc/mail/sendmail.mc.
If you've accidentaly erased /etc/mail/sendmail.mc, check /var/backups.
I am creating a safe, default sendmail.mc for you and you can
run sendmailconfig later if you need to change the defaults.
EOT
fi;
if [ -x /usr/share/sendmail/update_sendmail ]; then
stop_mta;
echo "Updating sendmail environment ...";
/usr/share/sendmail/update_sendmail || true;
start_mta;
fi;
exit 0;
#-----------------------------------------------------------
# See if we can do this automagically...
cat <<-EOT
It is a good idea to regenerate the sendmail configuration
file with each new spin of the sendmail package.
But, if you hand edit sendmail.cf instead of making changes through
sendmail.mc, then you want to say no, save your old sendmail.cf, run
sendmailconfig, then migrate your changes into the new version.
EOT
echo -n "Automagically regenerate the sendmail.cf configuration file? (Y/n) ";
read yn;
yn=$(echo -n "$yn" | sed -e "s/^\ *//" -e "s/^\t*//");
test -n "$yn" || yn="Y";
case "$yn" in
[Yy]*)
if [ -f /etc/mail/sendmail.cf ]; then
echo "Saving old /etc/mail/sendmail.cf" \
"as /etc/mail/sendmail.cf.old ...";
cp -f /etc/mail/sendmail.cf \
/etc/mail/sendmail.cf.old;
chown root:root /etc/mail/sendmail.cf.old;
chmod 0644 /etc/mail/sendmail.cf.old;
fi;
if [ -f /etc/mail/submit.cf ]; then
cp -f /etc/mail/submit.cf \
/etc/mail/submit.cf.old;
chown root:root /etc/mail/submit.cf.old;
chmod 0644 /etc/mail/submit.cf.old;
fi;
if [ -x /usr/share/sendmail/update_sendmail ]; then
stop_mta;
echo "Updating sendmail environment ...";
/usr/share/sendmail/update_sendmail || true;
fi;
;;
[Nn]*)
cat <<-EOT
Your files (sendmail.mc,cf, etc) have *not* been altered.
*** Warning *** Warning *** Warning *** Warning *** Warning *** Warning ***
There have been changes in
* Paths of some databases and executables
* FEATUREs, DOMAIN, includes
* Internal Database storage
These changes were *NOT* made for you ... And will not be
until you run sendmailconfig!
Until you update /etc/mail/sendmail.cf via sendmailconfig,
you should expect to have problems running sendmail!
"Well, a pet peeve of mine is people who directly edit the
.cf file instead of using the m4 configuration files.
Don't do it! [laughs] I treat the .cf file as a binary
file - you should too."
-- Eric Allman 1999/10/18
*** Warning *** Warning *** Warning *** Warning *** Warning *** Warning ***
EOT
echo "Do you wish to run sendmailconfig now, or later";
start_ask=0;
configure_mta;
case "$yn" in
[Yy]*)
cat <<-EOT
Do you wish to start sendmail with the new sendmail.cf,
or do you wish to delay until you can merge any changes
from your older sendmail.cf.old?
EOT
start_ask=1;
start_mta;
;;
esac;
exit 0;
esac;
#-----------------------------------------------------------
# If we're still here, we're going the automagic path...
# Now, liberal application of smoke and mirrors
if [ -f /etc/mail/sendmail.mc ]; then
start_ask=1;
start_mta;
fi;
exit 0;
#-----------------------------------------------------------
#
# List herein (for reference) what debhelper would've done:
# Automatically added by dh_installinit
if [ -x "/etc/init.d/sendmail" ] || [ -e "/etc/init/sendmail.conf" ]; then
if [ ! -e "/etc/init/sendmail.conf" ]; then
update-rc.d sendmail --update-rcd-params=defaults 21 19 >/dev/null
fi
invoke-rc.d sendmail start || exit $?
fi
# End automatically added section
exit 0;
|