#!/bin/sh

# This script is used to update the plugins configuration files.

USAGE="\n\
This script is used to update the plugins configuration file. It takes no\n\
options.\n\
Usage: update-ogre-plugins\n\
\n"

while [ "$#" -gt "0" ]
do
    case "$1" in
        *)
            echo "${USAGE}"
            exit 1
            ;;
    esac
done

echo "Updating /etc/OGRE/plugins.cfg."
sed -e '/# -\*- ogre-plugins -\*-/ q' \
	/etc/OGRE/plugins.cfg \
	>/etc/OGRE/plugins.cfg-new

PARTS="`ls 2>/dev/null /etc/OGRE/plugins.cfg.*`"
for f in $PARTS ; do
	if [ -z "`echo $f | grep dpkg`" ] ; then
		echo Adding $f
		cat $f >>/etc/OGRE/plugins.cfg-new
	fi
done

mv /etc/OGRE/plugins.cfg-new /etc/OGRE/plugins.cfg

