#!/bin/bash

# Uncomment the following line if you're having trouble with gnome-keyring lockups.
# This will cause passwords to be stored only temporarily for the session.
#WB_NO_GNOME_KEYRING=1

# force disable the Mac style single menu hack in Ubuntu Unity
UBUNTU_MENUPROXY=0

program_path="$0"

bindirname=`dirname $program_path`
basedirname=/

libdir=#libdir#
wblibdir="$libdir/mysql-workbench"

# if libcairo and pixman are in the wb libraries dir, force them to be preloaded
if test -f $wblibdir/libcairo.so.2; then
	if test "$LD_PRELOAD" != ""; then
		export LD_PRELOAD="$LD_PRELOAD:$wblibdir/libcairo.so.2"
	else
		export LD_PRELOAD="$wblibdir/libcairo.so.2"
	fi
fi
if test -f $wblibdir/libpixman-1.so.0; then
	if test "$LD_PRELOAD" != ""; then
		export LD_PRELOAD="$LD_PRELOAD:$wblibdir/libpixman.so.0"
	else
		export LD_PRELOAD="$wblibdir/libpixman.so.0"
	fi
fi


if test "$LD_LIBRARY_PATH" != ""; then
export LD_LIBRARY_PATH="$wblibdir:$LD_LIBRARY_PATH"
else
export LD_LIBRARY_PATH="$wblibdir"
fi

export MWB_DATA_DIR="/usr/share/mysql-workbench"
export MWB_LIBRARY_DIR="${MWB_DATA_DIR}/libraries"
export MWB_MODULE_DIR="$wblibdir/modules"
export MWB_PLUGIN_DIR="$wblibdir"

export DBC_DRIVER_PATH="$wblibdir"

# List of commands provided by mysql-utilities program, used to tell the user what are the available utilities
export MYSQL_UTILITIES_COMMANDS="#utilities_cmds#"

#if test "$PYTHONPATH" != ""; then
#export PYTHONPATH="$PYTHONPATH:/usr/share/mysql-workbench/python"
#else
#export PYTHONPATH="/usr/share/mysql-workbench/python"
#fi
#export PATH="$PATH:/usr/share/mysql-workbench/python"


if type -p catchsegv > /dev/null; then
catchsegv $wblibdir/bin/mysql-workbench-bin "$@"
else
$wblibdir/bin/mysql-workbench-bin "$@"
fi
