#!/bin/sh
# This scirpt check your webdot configuration.

set -e

c="/etc/bugzilla3/params"

# We assume if GraphViz is installed the webdot support should be enabled.
if test -x /usr/bin/dot; then
	if ! grep -q "webdotbase.*=>.*/usr/bin/dot" "$c"; then
		echo "W: To make sure GraphViz works with Bugzilla successfully please"
		echo "   edit the $c configuration file and add/edit the line with the"
		echo "   configuration paremter 'webdotbase' and set it's value"
		echo "   to '/usr/bin/dot'. The line should look like:"
		echo ""
		echo "   'webdotbase' => '/usr/bin/dot',"
		echo ""
		echo "   Do not forget the , (comma) at the end of the line!"
	fi
	if ! test -L /usr/lib/cgi-bin/bugzilla3/webdot || ! test -d /var/lib/bugzilla3/data/webdot; then
		echo "W: To make sure GraphViz works with Bugzilla successfully please"
		echo "   make sure the directory /var/lib/bugzilla3/data/webdot exists"
		echo "   and is sym-linked by /usr/lib/cgi-bin/bugzilla3/webdot. You can"
		echo "   do so by following commands:"
		echo ""
		echo "   mkdir -p /var/lib/bugzilla3/data/webdot"
		echo "   ln -fs /var/lib/bugzilla3/data/webdot /usr/lib/cgi-bin/bugzilla3/webdot"
		echo ""
	fi
fi

exit 0
