#
case "${ACTION}" in
pre)
	#
	# xbps-base-files 0.37 does not have the XBPS triggers anymore.
	# If installed package is less than 0.37 remove them before
	# upgrading the package.
	#
	if command -v xbps-uhelper.static 2>&1 >/dev/null; then
		uhelper="$(command -v xbps-uhelper.static)"
	elif command -v xbps-uhelper 2>&1 >/dev/null; then
		uhelper="$(command -v xbps-uhelper)"
	else
		exit 0
	fi

	set +e
	${uhelper} cmpver $(${uhelper} version xbps-base-files) 0.37
	if [ $? -eq 255 ]; then
		echo -n "Removing XBPS trigger files, now owned by the "
		echo "xbps-triggers package..."
		rm -vf var/db/xbps/triggers/*
	fi
	set -e
	;;
esac
