#! /bin/sh -e

set -e

if [ "$1" = purge ]; then

	if [ -e /usr/share/debconf/confmodule ]; then
		. /usr/share/debconf/confmodule
		db_purge
	fi

	if [ -f /etc/apparmor.d/samba/smbd-shares ]; then
		rm /etc/apparmor.d/samba/smbd-shares
	fi

	# compat symlink for a dir used for print jobs in the past
	rm -f /var/spool/samba

fi

# Automatically added by dh_installinit/13.24.2
if [ "$1" = "remove" ] && [ -x "/etc/init.d/nmbd" ] ; then
	chmod -x "/etc/init.d/nmbd" >/dev/null || true
fi
if [ -z "$DPKG_ROOT" ] && [ "$1" = "purge" ] ; then
	update-rc.d nmbd remove >/dev/null
fi
# End automatically added section
# Automatically added by dh_installinit/13.24.2
if [ "$1" = "remove" ] && [ -x "/etc/init.d/smbd" ] ; then
	chmod -x "/etc/init.d/smbd" >/dev/null || true
fi
if [ -z "$DPKG_ROOT" ] && [ "$1" = "purge" ] ; then
	update-rc.d smbd remove >/dev/null
fi
# End automatically added section
# Automatically added by dh_installdeb/13.24.2
dpkg-maintscript-helper rm_conffile /etc/cron.daily/samba 2:4.19.3\+dfsg-3\~ -- "$@"
dpkg-maintscript-helper rm_conffile /etc/logrotate.d/samba 2:4.19.4\+dfsg-3\~ -- "$@"
dpkg-maintscript-helper rm_conffile /etc/init.d/samba-ad-dc 2:4.21.1\+dfsg-1 -- "$@"
# End automatically added section
# Automatically added by dh_installsystemd/13.24.2
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.2
if [ "$1" = "purge" ]; then
	if [ -x "/usr/bin/deb-systemd-helper" ]; then
		deb-systemd-helper purge 'nmbd.service' >/dev/null || true
	fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.24.2
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.2
if [ "$1" = "purge" ]; then
	if [ -x "/usr/bin/deb-systemd-helper" ]; then
		deb-systemd-helper purge 'smbd.service' >/dev/null || true
	fi
fi
# End automatically added section

