#!/bin/sh
#/*****************************************************************************
#*
#* Copyright (c) [2009] Novell, Inc.
#* All Rights Reserved.
#*
#* This program is free software; you can redistribute it and/or
#* modify it under the terms of version 2 of the GNU General Public License as
#* published by the Free Software Foundation.
#*
#* This program is distributed in the hope that it will be useful,
#* but WITHOUT ANY WARRANTY; without even the implied warranty of
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   See the
#* GNU General Public License for more details.
#*
#* You should have received a copy of the GNU General Public License
#* along with this program; if not, contact Novell, Inc.
#*
#* To contact Novell about this file by physical or electronic mail,
#* you may find current contact information at www.novell.com
#*
#*-----------------------------------------------------------------------------
#*
#*                 Novell iFolder Enterprise
#*
#*-----------------------------------------------------------------------------
#*
#*                 $Author: Kalidas Balakrishnan
#*                 $Modified by: <Modifier>
#*                 $Mod Date: <Date Modified>
#*                 $Revision: 0.1
#*-----------------------------------------------------------------------------
#* This module is used to:
#*        < iFolder Admin setup Script >
#*
#*
#*******************************************************************************/


OS_ARCH=`uname -m | grep -c x86_64`
if [ $OS_ARCH -gt 0 ]
then
	export OS_ARCH=`uname -m`
fi

rpm -q novell-ifolder-mono > /dev/null 2>&1
if [ $? -gt 0 ]
then
	export MONO_PATH=/usr/lib/simias/web/bin:/usr/bin
	export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/simias/web/bin
	export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/usr/lib/simias/web/bin
	cd /usr/bin

	mono /usr/bin/iFolderAdminSetup.exe "$@"
else
	MONO_RUNTIME_PATH=/usr/bin/../mono
	export MONO_PATH=$MONO_RUNTIME_PATH/lib/mono/:$MONO_RUNTIME_PATH/lib/mono/2.0:/usr/lib/simias/web/bin:/usr/bin
	source $MONO_RUNTIME_PATH/bin/novell-ifolder-mono-environment.sh
	export MONO_CFG_DIR=$MONO_RUNTIME_PATH/etc
	export IFOLDER_MOD_MONO_SERVER2_PATH=/usr/bin
	export IFOLDER_MONO_PATH=$MONO_RUNTIME_PATH
	cd /usr/bin

	$MONO_RUNTIME_PATH/bin/mono /usr/bin/iFolderAdminSetup.exe "$@"
fi
