#!/bin/sh

set -e

pkg=$(basename $0 .postinst)

if [ "$1" = "configure" ]; then
	test -e /etc/lvmtab || touch /etc/lvmtab
	test -x /usr/sbin/update-devfsd && /usr/sbin/update-devfsd
	update-modules

	update-rc.d lvm start 26 S . start 50 0 6 . > /dev/null
	/usr/sbin/lvm-bin-scan
fi

# older versions had '/etc/cron.d/lvm', which wasn't removed.
# Check for this on upgrade, and remove it.
if [ "$1" = "upgrade" ]; then
	if [ -e /etc/cron.d/lvm ] ; then
		rm -f /etc/cron.d/lvm
	fi
fi

# if upgrading, and '/etc/cron.d/lvm-common' exists, remove it.
if [ "$1" = "upgrade" ]; then
	if [ -e /etc/cron.d/lvm-common ] ; then
		rm -f /etc/cron.d/lvm-common
	fi
fi

exit 0

