#!/bin/sh

set -e

case "${1}" in
	configure)
		# For some versions in the 0.9.0 branch, the .service files
		# were containing an WantedBy option. This was useless as all
		# the .service files are already statically enabled.
		# The option has been removed but we still need to take care of
		# removing the leftover.
		if dpkg --compare-versions "$2" le-nl "0.9.0-6~"; then
			deb-systemd-helper purge plymouth-halt.service plymouth-kexec.service plymouth-poweroff.service plymouth-quit.service plymouth-quit-wait.service plymouth-read-write.service plymouth-reboot.service plymouth-start.service >/dev/null
			deb-systemd-helper unmask plymouth-halt.service plymouth-kexec.service plymouth-poweroff.service plymouth-quit.service plymouth-quit-wait.service plymouth-read-write.service plymouth-reboot.service plymouth-start.service >/dev/null
		fi
		if which update-initramfs >/dev/null 2>&1; then
			update-initramfs -u
		fi
		;;

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

		;;

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

#DEBHELPER#

exit 0