#!/bin/bash
export LD_LIBRARY_PATH=/opt/novell/groupwise/client/lib:/opt/novell/groupwise/client/java/lib/i386

if [ -f /etc/SuSE-release ] ; then
	_version=$(cat /etc/SuSE-release | grep VERSION | cut -f3 -d' ' | cut -f1 -d'.')
	if [ $_version -ge 10 ] ; then
		_plugindir=/usr/lib/browser-plugins
		if [ -d $_plugindir ] ; then
			export MOZ_PLUGIN_PATH=$HOME/.novell/groupwise/browser-plugins
			if [ -d $MOZ_PLUGIN_PATH ] ; then
				rm -f $MOZ_PLUGIN_PATH/*
			else
				mkdir -p $MOZ_PLUGIN_PATH
			fi
			pushd $MOZ_PLUGIN_PATH &>/dev/null
			for file in $_plugindir/* ; do
				# Disable Java and Flash (if not v7) because they are causing crashes in some cases
				if ( echo $file | grep java &>/dev/null ) ; then
					continue
				elif  ( echo $file | grep flash &>/dev/null ) && ( ! rpm -q flash-player | grep 'flash-player-7.0' &>/dev/null ) ; then
					continue
				else
					ln -sf $file
				fi
			done
			popd  &>/dev/null
		fi
	fi
fi

/opt/novell/groupwise/client/bin/groupwise-bin "$@"
