#!/bin/sh # Exit immediately if a command produces an error. set -e USER=courier GROUP=courier # Source debconf library . /usr/share/debconf/confmodule # Create a dpkg-statoverride delete function. This can be removed in forky+1. del_override() { if dpkg-statoverride --list $1 >/dev/null; then dpkg-statoverride --remove $1 fi } if [ "$1" = "configure" ]; then # Delete the old diversions if they exist, which are no longer needed. # These commands can be removed in trixie +1. # See # See also if [ -n "$(dpkg-divert --list courier-mta)" ]; then dpkg-divert --package courier-mta --remove --rename \ --divert /usr/bin/addcr.ucspi-tcp /usr/bin/addcr dpkg-divert --package courier-mta --remove --rename \ --divert /usr/share/man/man1/addcr.ucspi-tcp.1.gz /usr/share/man/man1/addcr.1.gz fi # write default domain file db_get courier-mta/defaultdomain echo $RET > /etc/courier/defaultdomain # generate locals file if necessary if [ ! -f /etc/courier/locals ]; then echo "localhost" > /etc/courier/locals echo "$RET" >> /etc/courier/locals fi # generate configuration directories if necessary. db_get courier-base/webadmin-configmode if [ "$RET" = true ]; then for dir in esmtpacceptmailfor.dir; do mkdir -p /etc/courier/$dir chmod 0750 /etc/courier/$dir chown root:courier /etc/courier/$dir done fi # generate /etc/mailname if necessary if [ ! -f /etc/mailname ]; then echo "$RET" > /etc/mailname fi # write file with From: header for delivery notifications db_get courier-mta/dsnfrom echo $RET > /etc/courier/dsnfrom # Update Alternatives if [ -f /usr/share/man/man1/lockmail.1.gz ]; then LOCKMAIL_SLAVE="--slave /usr/share/man/man1/lockmail.1.gz lockmail.1.gz /usr/share/man/man1/lockmail.courier.1.gz" fi update-alternatives --install /usr/bin/lockmail lockmail /usr/bin/lockmail.courier 5 ${LOCKMAIL_SLAVE} if [ -f /usr/share/man/man1/preline.1.gz ]; then PRELINE_SLAVE="--slave /usr/share/man/man1/preline.1.gz preline.1.gz /usr/share/man/man1/preline.courier.1.gz" fi update-alternatives --install /usr/bin/preline preline /usr/bin/preline.courier 5 ${PRELINE_SLAVE} if [ ! -f /etc/courier/esmtpd.pem ]; then mkesmtpdcert chmod 0640 /etc/courier/esmtpd.pem chown root:courier /etc/courier/esmtpd.pem fi # Remove the obsolete dpkg-statoverrides. These lines can be removed in forky+1. del_override /etc/courier/aliasdir del_override /etc/courier/aliases del_override /etc/courier/aliases/system del_override /etc/courier/esmtpauthclient del_override /etc/courier/esmtpd.cnf del_override /etc/courier/filters del_override /etc/courier/filters/active del_override /usr/bin/cancelmsg del_override /usr/bin/mailq del_override /usr/lib/courier/courier/submitmkdir del_override /usr/sbin/rmail del_override /usr/sbin/sendmail del_override /var/lib/courier/allfilters del_override /var/lib/courier/filters del_override /var/lib/courier/msgq del_override /var/lib/courier/msgs del_override /var/lib/courier/tmp del_override /var/lib/courier/track fi # Automatically added by dh_installtmpfiles/14.3 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then systemd-tmpfiles ${DPKG_ROOT:+--root="$DPKG_ROOT"} --create courier-mta.conf fi # End automatically added section # Automatically added by dh_installinit/14.3 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -x "$DPKG_ROOT/etc/init.d/courier" ]; then update-rc.d courier defaults >/dev/null if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi if [ -z "$DPKG_ROOT" ]; then invoke-rc.d --skip-systemd-native courier $_dh_action || exit 1 fi fi fi # End automatically added section # Automatically added by dh_installinit/14.3 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -x "$DPKG_ROOT/etc/init.d/courierfilter" ]; then update-rc.d courierfilter defaults >/dev/null if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi if [ -z "$DPKG_ROOT" ]; then invoke-rc.d --skip-systemd-native courierfilter $_dh_action || exit 1 fi fi fi # End automatically added section # Automatically added by dh_installinit/14.3 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -x "$DPKG_ROOT/etc/init.d/courier-mta" ]; then update-rc.d courier-mta defaults >/dev/null if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi if [ -z "$DPKG_ROOT" ]; then invoke-rc.d --skip-systemd-native courier-mta $_dh_action || exit 1 fi fi fi # End automatically added section # Automatically added by dh_installinit/14.3 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -x "$DPKG_ROOT/etc/init.d/courier-mta-ssl" ]; then update-rc.d courier-mta-ssl defaults >/dev/null if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi if [ -z "$DPKG_ROOT" ]; then invoke-rc.d --skip-systemd-native courier-mta-ssl $_dh_action || exit 1 fi fi fi # End automatically added section # Automatically added by dh_installinit/14.3 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -x "$DPKG_ROOT/etc/init.d/courier-msa" ]; then update-rc.d courier-msa defaults >/dev/null if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi if [ -z "$DPKG_ROOT" ]; then invoke-rc.d --skip-systemd-native courier-msa $_dh_action || exit 1 fi fi fi # End automatically added section # Automatically added by dh_installsystemd/14.3 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then # The following line should be removed in trixie or trixie+1 deb-systemd-helper unmask 'courier.service' >/dev/null || true # was-enabled defaults to true, so new installations run enable. if deb-systemd-helper --quiet was-enabled 'courier.service'; then # Enables the unit on first installation, creates new # symlinks on upgrades if the unit file has changed. deb-systemd-helper enable 'courier.service' >/dev/null || true else # Update the statefile to add new symlinks (if any), which need to be # cleaned up on purge. Also remove old symlinks. deb-systemd-helper update-state 'courier.service' >/dev/null || true fi fi # End automatically added section # Automatically added by dh_installsystemd/14.3 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -z "$DPKG_ROOT" ] && [ -d /run/systemd/system ]; then systemctl --system daemon-reload >/dev/null || true if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi deb-systemd-invoke $_dh_action 'courier.service' >/dev/null || true fi fi # End automatically added section # Automatically added by dh_installsystemd/14.3 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then # The following line should be removed in trixie or trixie+1 deb-systemd-helper unmask 'courierfilter.service' >/dev/null || true # was-enabled defaults to true, so new installations run enable. if deb-systemd-helper --quiet was-enabled 'courierfilter.service'; then # Enables the unit on first installation, creates new # symlinks on upgrades if the unit file has changed. deb-systemd-helper enable 'courierfilter.service' >/dev/null || true else # Update the statefile to add new symlinks (if any), which need to be # cleaned up on purge. Also remove old symlinks. deb-systemd-helper update-state 'courierfilter.service' >/dev/null || true fi fi # End automatically added section # Automatically added by dh_installsystemd/14.3 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -z "$DPKG_ROOT" ] && [ -d /run/systemd/system ]; then systemctl --system daemon-reload >/dev/null || true if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi deb-systemd-invoke $_dh_action 'courierfilter.service' >/dev/null || true fi fi # End automatically added section # Automatically added by dh_installsystemd/14.3 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then # The following line should be removed in trixie or trixie+1 deb-systemd-helper unmask 'courier-mta.service' >/dev/null || true # was-enabled defaults to true, so new installations run enable. if deb-systemd-helper --quiet was-enabled 'courier-mta.service'; then # Enables the unit on first installation, creates new # symlinks on upgrades if the unit file has changed. deb-systemd-helper enable 'courier-mta.service' >/dev/null || true else # Update the statefile to add new symlinks (if any), which need to be # cleaned up on purge. Also remove old symlinks. deb-systemd-helper update-state 'courier-mta.service' >/dev/null || true fi fi # End automatically added section # Automatically added by dh_installsystemd/14.3 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -z "$DPKG_ROOT" ] && [ -d /run/systemd/system ]; then systemctl --system daemon-reload >/dev/null || true if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi deb-systemd-invoke $_dh_action 'courier-mta.service' >/dev/null || true fi fi # End automatically added section # Automatically added by dh_installsystemd/14.3 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then # The following line should be removed in trixie or trixie+1 deb-systemd-helper unmask 'courier-mta-ssl.service' >/dev/null || true # was-enabled defaults to true, so new installations run enable. if deb-systemd-helper --quiet was-enabled 'courier-mta-ssl.service'; then # Enables the unit on first installation, creates new # symlinks on upgrades if the unit file has changed. deb-systemd-helper enable 'courier-mta-ssl.service' >/dev/null || true else # Update the statefile to add new symlinks (if any), which need to be # cleaned up on purge. Also remove old symlinks. deb-systemd-helper update-state 'courier-mta-ssl.service' >/dev/null || true fi fi # End automatically added section # Automatically added by dh_installsystemd/14.3 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -z "$DPKG_ROOT" ] && [ -d /run/systemd/system ]; then systemctl --system daemon-reload >/dev/null || true if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi deb-systemd-invoke $_dh_action 'courier-mta-ssl.service' >/dev/null || true fi fi # End automatically added section # Automatically added by dh_installsystemd/14.3 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then # The following line should be removed in trixie or trixie+1 deb-systemd-helper unmask 'courier-msa.service' >/dev/null || true # was-enabled defaults to true, so new installations run enable. if deb-systemd-helper --quiet was-enabled 'courier-msa.service'; then # Enables the unit on first installation, creates new # symlinks on upgrades if the unit file has changed. deb-systemd-helper enable 'courier-msa.service' >/dev/null || true else # Update the statefile to add new symlinks (if any), which need to be # cleaned up on purge. Also remove old symlinks. deb-systemd-helper update-state 'courier-msa.service' >/dev/null || true fi fi # End automatically added section # Automatically added by dh_installsystemd/14.3 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -z "$DPKG_ROOT" ] && [ -d /run/systemd/system ]; then systemctl --system daemon-reload >/dev/null || true if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi deb-systemd-invoke $_dh_action 'courier-msa.service' >/dev/null || true fi fi # End automatically added section exit 0