#!/bin/sh
# postrm script for s6-rc-service-sshd.
#
# See: dh_installdeb(1).

set -e

case "$1" in
    remove|purge)
    
    # Recompile system database after service removal
	[ -x /usr/bin/s6-db-reload ] && echo "recompiling system database" && sleep 1 && s6-db-reload
	
	# Recompile database for each user after service removal
	getent passwd $(basename -a /home/*) | awk -F: '{print $1}' | while read user; do
	[ -x /usr/bin/s6-db-reload ] && echo "recompiling user database for user: $user" && sleep 1 && runuser -u $user -- s6-db-reload -u
	done
			
	;;
	
    upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
    ;;

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

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

#DEBHELPER#

exit 0

