#!/bin/sh
# postrm script for pagure
#
# see: dh_installdeb(1)

set -e

# Source debconf library.
if test -f /usr/share/debconf/confmodule ; then
    . /usr/share/debconf/confmodule
fi

# Source information about the pagure user.
PAGURE_USER="_pagure"
PAGURE_HOME="/srv/pagure"

case "$1" in
    purge)
	# Delete the pagure user.  We explicitly don't delete any
	# files here because we don't want to delete user data.
	if getent passwd "$PAGURE_USER" > /dev/null; then
	   deluser "$PAGURE_USER" || true
	fi
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

# Automatically added by dh_installsystemd/13.24.1
if [ "$1" = remove ] && [ -d /run/systemd/system ] ; then
	systemctl --system daemon-reload >/dev/null || true
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.24.1
if [ "$1" = "purge" ]; then
	if [ -x "/usr/bin/deb-systemd-helper" ]; then
		deb-systemd-helper purge 'pagure-authorized-keys-worker.service' >/dev/null || true
	fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.24.1
if [ "$1" = remove ] && [ -d /run/systemd/system ] ; then
	systemctl --system daemon-reload >/dev/null || true
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.24.1
if [ "$1" = "purge" ]; then
	if [ -x "/usr/bin/deb-systemd-helper" ]; then
		deb-systemd-helper purge 'pagure-mirror-project-in.timer' >/dev/null || true
	fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.24.1
if [ "$1" = remove ] && [ -d /run/systemd/system ] ; then
	systemctl --system daemon-reload >/dev/null || true
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.24.1
if [ "$1" = "purge" ]; then
	if [ -x "/usr/bin/deb-systemd-helper" ]; then
		deb-systemd-helper purge 'pagure-api-key-expire-mail.timer' >/dev/null || true
	fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.24.1
if [ "$1" = remove ] && [ -d /run/systemd/system ] ; then
	systemctl --system daemon-reload >/dev/null || true
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.24.1
if [ "$1" = "purge" ]; then
	if [ -x "/usr/bin/deb-systemd-helper" ]; then
		deb-systemd-helper purge 'pagure-gitolite-worker.service' >/dev/null || true
	fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.24.1
if [ "$1" = remove ] && [ -d /run/systemd/system ] ; then
	systemctl --system daemon-reload >/dev/null || true
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.24.1
if [ "$1" = "purge" ]; then
	if [ -x "/usr/bin/deb-systemd-helper" ]; then
		deb-systemd-helper purge 'pagure-worker.service' >/dev/null || true
	fi
fi
# End automatically added section
# Automatically added by dh_apache2/UNDECLARED
if [ "$1" = "purge" ] ; then
	if true; then
		if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
			. /usr/share/apache2/apache2-maintscript-helper

			for conf in pagure  ; do
				apache2_invoke disconf $conf  || exit 1
			done
		fi
	fi
fi
# End automatically added section


exit 0