Current File : //var/lib/dpkg/info/rspamd.postinst
#!/bin/sh
set -e

case "$1" in
    configure)
       SERVER_HOME=/var/lib/rspamd
       SERVER_LOG=/var/log/rspamd
       SERVER_USER=_rspamd

       adduser --quiet \
               --system \
               --group \
               --home $SERVER_HOME \
               --no-create-home \
               --disabled-login \
               --gecos "rspamd spam filtering system" \
               --force-badname \
               $SERVER_USER
       mkdir -p $SERVER_HOME $SERVER_LOG || true
       chown $SERVER_USER: $SERVER_HOME $SERVER_LOG
    ;;

    abort-*)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

# Automatically added by dh_systemd_enable/13.11.4
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 'rspamd.service' >/dev/null || true

	# was-enabled defaults to true, so new installations run enable.
	if deb-systemd-helper --quiet was-enabled 'rspamd.service'; then
		# Enables the unit on first installation, creates new
		# symlinks on upgrades if the unit file has changed.
		deb-systemd-helper enable 'rspamd.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 'rspamd.service' >/dev/null || true
	fi
fi
# End automatically added section
# Automatically added by dh_installdeb/13.11.4
dpkg-maintscript-helper rm_conffile /etc/rspamd/logging.conf 0.6.11\~ rspamd -- "$@"
dpkg-maintscript-helper rm_conffile /etc/rspamd/options.conf 0.6.11\~ rspamd -- "$@"
dpkg-maintscript-helper rm_conffile /etc/rspamd/workers.conf 0.6.11\~ rspamd -- "$@"
# End automatically added section
# Automatically added by dh_installinit/13.11.4
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	if [ -z "${DPKG_ROOT:-}" ] && [ -x "/etc/init.d/rspamd" ]; then
		update-rc.d rspamd defaults >/dev/null
		if [ -n "$2" ]; then
			_dh_action=restart
		else
			_dh_action=start
		fi
		invoke-rc.d rspamd $_dh_action || exit 1
	fi
fi
# End automatically added section


exit 0