#!/bin/sh

set -e

case "${1}" in
	configure)
		if [ -x /usr/sbin/update-initramfs ] && [ -e /etc/initramfs-tools/initramfs.conf ]
		then
			update-initramfs -u
		fi
		;;

	abort-upgrade|abort-remove|abort-deconfigure)

		;;

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

#DEBHELPER#
#
# dh_installsystemd doesn't handle template services even if we supply a
# default instance, so we'll install it here.
if [ -z "${DPKG_ROOT:-}" ] && [ -d /run/systemd/system ] ; then
	if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
		/bin/systemctl enable xfs_healer@.service || true
	fi
fi

exit 0
