#!/bin/sh

set -e

if [ "$1" = remove ] && [ "${DPKG_MAINTSCRIPT_PACKAGE_REFCOUNT:-1}" = 1 ]; then
	pam-auth-update --package --remove winbind
fi

# Automatically added by dh_installsystemd/13.23~bpo12+1
if [ -z "${DPKG_ROOT:-}" ] && [ "$1" = remove ] && [ -d /run/systemd/system ] ; then
	deb-systemd-invoke stop 'ctdb.service' 'nmbd.service' 'samba-bgqd.service' 'smbd.service' 'winbind.service' 'wsdd.service' >/dev/null || true
fi
# End automatically added section
# Automatically added by dh_installdeb/13.23~bpo12+1
dpkg-maintscript-helper rm_conffile /etc/init.d/samba 2:4.6.5\+dfsg-5\~ -- "$@"
dpkg-maintscript-helper rm_conffile /etc/init/nmbd.conf 2:4.6.5\+dfsg-5\~ -- "$@"
dpkg-maintscript-helper rm_conffile /etc/init/reload-smbd.conf 2:4.6.5\+dfsg-5\~ -- "$@"
dpkg-maintscript-helper rm_conffile /etc/init/samba-ad-dc.conf 2:4.6.5\+dfsg-5\~ -- "$@"
dpkg-maintscript-helper rm_conffile /etc/init/smbd.conf 2:4.6.5\+dfsg-5\~ -- "$@"
dpkg-maintscript-helper mv_conffile /etc/default/ctdb /etc/ctdb/ctdbd.conf 2:4.5.0\+dfsg-1\~ -- "$@"
# End automatically added section

# Automatically added by dh_python3
if command -v py3clean >/dev/null 2>&1; then
	py3clean -p truenas-samba:amd64 
else
	dpkg -L truenas-samba:amd64 | sed -En -e '/^(.*)\/(.+)\.py$/s,,rm "\1/__pycache__/\2".*,e'
	find /usr/lib/python3/dist-packages/ -type d -name __pycache__ -empty -print0 | xargs --null --no-run-if-empty rmdir
fi

# End automatically added section

