#!/bin/sh # Exit immediately if a command produces an error. set -e USER=courier GROUP=courier # Source debconf library . /usr/share/debconf/confmodule add_override() { if ! dpkg-statoverride --list $4 >/dev/null; then dpkg-statoverride --update --add $1 $2 $3 $4 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 hosteddomains; 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 add_override root root 0600 /etc/courier/esmtpd.cnf add_override root courier 4755 /usr/sbin/rmail add_override courier courier 2755 /usr/bin/mailq add_override courier courier 6755 /usr/bin/cancelmsg add_override root courier 2755 /usr/sbin/sendmail add_override courier courier 4755 /usr/lib/courier/courier/submitmkdir for dir in allfilters filters msgq msgs track; do add_override courier courier 0750 /var/lib/courier/$dir done add_override courier courier 0770 /var/lib/courier/tmp add_override root courier 0750 /etc/courier/aliasdir add_override root courier 0750 /etc/courier/aliases add_override root courier 0640 /etc/courier/aliases/system add_override root courier 0640 /etc/courier/esmtpauthclient add_override root courier 0750 /etc/courier/filters add_override root courier 0750 /etc/courier/filters/active fi # Automatically added by dh_installtmpfiles/13.24.2 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -x "$(command -v systemd-tmpfiles)" ]; then systemd-tmpfiles ${DPKG_ROOT:+--root="$DPKG_ROOT"} --create courier-mta.conf || true fi fi # End automatically added section # Automatically added by dh_installinit/13.24.2 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -z "$DPKG_ROOT" ] && [ -x "/etc/init.d/courier" ]; then update-rc.d courier defaults >/dev/null if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi invoke-rc.d --skip-systemd-native courier $_dh_action || exit 1 fi fi # End automatically added section # Automatically added by dh_installinit/13.24.2 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -z "$DPKG_ROOT" ] && [ -x "/etc/init.d/courierfilter" ]; then update-rc.d courierfilter defaults >/dev/null if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi invoke-rc.d --skip-systemd-native courierfilter $_dh_action || exit 1 fi fi # End automatically added section # Automatically added by dh_installinit/13.24.2 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -z "$DPKG_ROOT" ] && [ -x "/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 invoke-rc.d --skip-systemd-native courier-mta $_dh_action || exit 1 fi fi # End automatically added section # Automatically added by dh_installinit/13.24.2 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -z "$DPKG_ROOT" ] && [ -x "/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 invoke-rc.d --skip-systemd-native courier-mta-ssl $_dh_action || exit 1 fi fi # End automatically added section # Automatically added by dh_installinit/13.24.2 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -z "$DPKG_ROOT" ] && [ -x "/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 invoke-rc.d --skip-systemd-native courier-msa $_dh_action || exit 1 fi fi # End automatically added section # Automatically added by dh_installsystemd/13.24.2 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/13.24.2 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -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/13.24.2 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/13.24.2 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -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/13.24.2 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/13.24.2 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -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/13.24.2 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/13.24.2 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -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/13.24.2 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/13.24.2 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -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