##############################################################################
# Copyright (c) Members of the EGEE Collaboration. 2004. 
# See http://www.eu-egee.org/partners/ for details on the copyright 
# holders.  
#
# Licensed under the Apache License, Version 2.0 (the "License"); 
# you may not use this file except in compliance with the License. 
# You may obtain a copy of the License at 
#
#    http://www.apache.org/licenses/LICENSE-2.0 
#
# Unless required by applicable law or agreed to in writing, software 
# distributed under the License is distributed on an "AS IS" BASIS, 
# WITHOUT WARRANTIES OR CONDITIONS 
# OF ANY KIND, either express or implied. 
# See the License for the specific language governing permissions and 
# limitations under the License.
##############################################################################
#
# NAME :        config_globus_clients
#
# DESCRIPTION : This function configures the globus clients.
#
# AUTHORS :     Andreas.Unterkircher@cern.ch
#               Gergely.Debreczeni@cern.ch
#
# NOTES :      
#
# YAIM MODULE:  glite-yaim-core
#                 
##############################################################################

config_globus_clients_check(){
  if ( ! echo $NODE_TYPE_LIST | egrep -q WN ); then
    requires $1 GLOBUS_TCP_PORT_RANGE 
  fi
  retcode=$?
  return ${retcode}
}

config_globus_clients_setenv(){

	# environment export
#not needed for EMI
#	yaimgridenv_set GLOBUS_LOCATION ${GLOBUS_LOCATION}
        if ( ! echo $NODE_TYPE_LIST | egrep -q WN ); then
  	  yaimgridenv_set GLOBUS_TCP_PORT_RANGE "${GLOBUS_TCP_PORT_RANGE}"
        fi

# not needed for EMI	
#	yaimgridpath_prepend LD_LIBRARY_PATH ${GLOBUS_LOCATION}/lib
#	yaimgridpath_prepend PATH ${GLOBUS_LOCATION}/bin
#	yaimgridpath_prepend MANPATH ${GLOBUS_LOCATION}/man
	
	#	Configuration environment
#        yaimgridpath_append PERL5LIB "${GPT_LOCATION}/lib/perl"


        # Fix for bug #30998
        yaimgridenv_set GT_PROXY_MODE old
}


config_globus_clients(){
	yaimlog INFO "Configure the globus service - not needed in EMI"
# part not needed in EMI
	# Auxiliary script parameters (Local environment)
#	GPT_POST=${GPT_LOCATION}/sbin/gpt-postinstall
#	GLOBUS_SETUP=${GLOBUS_LOCATION}/setup

	# Check if directory and file already exist and set suitable permissions and ownerships

#	if [ ! -d ${GLOBUS_SETUP} ]; then
#  		yaimlog INFO "Globus doesn't seem to be correctly installed. Please verify"
#	fi

#	cd ${GLOBUS_SETUP}/globus/
#	./setup-tmpdirs
#	./setup-globus-common

#	[ -x ./setup-openssl ] && ./setup-openssl

        return 0
}

