#!/bin/bash

if [[ !  -f main ]] ; then
	echo "main does not exist"
	echo "did you compile it?"

	exit 1
fi

if [[ ! -f orge.cfg ]] ; then
	cp ogre.cfg-init ogre.cfg
fi

# check if plugins.cfg exists, and of not create it
# and modify 
if [[ ! -f plugins.cfg ]] ; then 
	is_tardis=`uname -n | grep tardis`
	echo "isTardis: ${is_tardis}"
	if [[ is_tardis  ]] ; then 
		sed -e 's:PluginFolder=/usr/lib/OGRE:PluginFolder=/usr/pack/ogre-1.4.5-sd/i686-debian-linux3.1/lib/OGRE/:' \
		-e 's:#Plugin=Plugin_CgProgramManager:Plugin=Plugin_CgProgramManager:' plugins.cfg-init > plugins.cfg
	fi
fi
exec ./main
