#!/bin/bash set -e handle_init_errs () { RET=$? if [ "$RET" = "6" ]; then return 0 else exit $RET fi set -e } case "$1" in install|configure) adduser --system --group \ --no-create-home --home /nonexistent \ --quiet spampd if dpkg --compare-versions "$2" le-nl 2.62-2~; then DEFAULT=/etc/default/spampd.dpkg-backup CONFIG=/etc/spampd.cfg if [ -f ${DEFAULT} ]; then . ${DEFAULT} istrue () { ANS=$(echo $1 | tr A-Z a-z) [ "$ANS" = 'yes' -o "$ANS" = 'true' -o "$ANS" = 'enable' -o "$ANS" = '1' ] } # # Find differences to default config # SED_ARGS= istrue "$TAGALL" || SED_ARGS="${SED_ARGS} -e 's/tagall 1/tagall 0/'" istrue "$LOCALONLY" || SED_ARGS="${SED_ARGS} -e 's/local-only 1/local-only 0/'" istrue "$LOGINET" && SED_ARGS="${SED_ARGS} -e 's/# logsock inet/logsock inet/'" [ -n "${LISTENPORT}" -a "${LISTENPORT}" -ne 10025 ] && SED_ARGS="${SED_ARGS} -e 's/port 10025/port ${LISTENPORT}/'" [ -n "${LISTENHOST}" -a "${LISTENHOST}" != "127.0.0.1" ] && SED_ARGS="${SED_ARGS} -e 's/host 127.0.0.1/host ${LISTENHOST}/'" [ -n "${DESTPORT}" -a "${DESTPORT}" -ne 10026 ] && SED_ARGS="${SED_ARGS} -e 's/relayport 10026/relayport ${DESTPORT}/'" [ -n "${DESTHOST}" -a "${DESTHOST}" != "127.0.0.1" ] && SED_ARGS="${SED_ARGS} -e 's/relayhost 127.0.0.1/relayhost ${DESTHOST}/'" [ -n "${CHILDREN}" -a "${CHILDREN}" -ne 3 ] && SED_ARGS="${SED_ARGS} -e 's/max-servers 3/max-servers ${CHILDREN}/'" [ -n "${USERID}" -a "${USERID}" != "spampd" ] && SED_ARGS="${SED_ARGS} -e 's/user spampd/user ${USERID}/'" [ -n "${GRPID}" -a "${GRPID}" != "spampd" ] && SED_ARGS="${SED_ARGS} -e 's/group spampd/group ${GRPID}/'" if [ -n "${ADDOPTS}" ]; then shopt -s extglob ADD=${ADDOPTS/#?(-|--)/\\n} # first option ADD=${ADD//+( )?(-|--)/\\n} # subsequent option(s) SED_ARGS="${SED_ARGS} -e 's%# Inserted from ADDOPTS in spampd.default file:%# Inserted from ADDOPTS in spampd.default file:${ADD}%'" fi if [ -n "${SED_ARGS}" ]; then eval "sed ${SED_ARGS} ${CONFIG} > ${CONFIG}.dpkg-new && mv ${CONFIG}.dpkg-new ${CONFIG}" fi fi fi ;; *) ;; esac # Automatically added by dh_installdeb/13.24.1 dpkg-maintscript-helper mv_conffile /etc/spampd.conf /etc/spampd.sa.cf 2.62-2\~ -- "$@" dpkg-maintscript-helper rm_conffile /etc/default/spampd 2.62-2\~ -- "$@" # End automatically added section # Automatically added by dh_installinit/13.24.1 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -z "$DPKG_ROOT" ] && [ -x "/etc/init.d/spampd" ]; then update-rc.d spampd defaults >/dev/null if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi invoke-rc.d --skip-systemd-native spampd $_dh_action || exit 1 fi fi # End automatically added section # Automatically added by dh_installsystemd/13.24.1 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 'spampd.service' >/dev/null || true # was-enabled defaults to true, so new installations run enable. if deb-systemd-helper --quiet was-enabled 'spampd.service'; then # Enables the unit on first installation, creates new # symlinks on upgrades if the unit file has changed. deb-systemd-helper enable 'spampd.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 'spampd.service' >/dev/null || true fi fi # End automatically added section # Automatically added by dh_installsystemd/13.24.1 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 'spampd.service' >/dev/null || true fi fi # End automatically added section