#!/bin/bash
#DEBHELPER#
set -e
mkdir /usr/share/q-gears/plugins

echo "PluginFolder = /usr/share/q-gears/plugins/" >> /usr/share/q-gears/plugins.cfg
ln -s /usr/lib/q-gears/plugins/Plugin_Data.so /usr/share/q-gears/plugins/Plugin_Data.so.1.9.0
if [ -d /usr/lib/i386-linux-gnu/OGRE-1.9.0 ];then 
  ln -s /usr/lib/i386-linux-gnu/OGRE-1.9.0/RenderSystem_GL.so /usr/share/q-gears/plugins/RenderSystem_GL.so.1.9.0
  echo "Plugin=RenderSystem_GL" >> /usr/share/q-gears/plugins.cfg
elif [ -d /usr/lib/x86_64-linux-gnu/OGRE-1.9.0 ];then   
  ln -s /usr/lib/x86_64-linux-gnu/OGRE-1.9.0/RenderSystem_GL.so /usr/share/q-gears/plugins/RenderSystem_GL.so.1.9.0
  echo "Plugin=RenderSystem_GL" >> /usr/share/q-gears/plugins.cfg
else echo "failed to detect OGRE"; 

fi   

echo "#Plugin=Plugin_Data" >> /usr/share/q-gears/plugins.cfg

echo "" >> /usr/share/q-gears/q-gears.cfg
chmod 666 /usr/share/q-gears/q-gears.cfg

