
##############################################################################
# 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_cream_detect_tomcat
#
# DESCRIPTION : This function configures tomcat user as VO user on a Cream CE.
#
# YAIM MODULE:  glite.yaim.cream-ce
#
##############################################################################

function config_cream_detect_tomcat_check () {

  requires $1  

}

function config_cream_detect_tomcat_setenv () {

  yaimlog DEBUG "No enviroment variables to set."

}

function config_cream_detect_tomcat () {

 # Call detect_tomcat which sets the variable TOMCAT_VERSION (e.g. to tomcat5)
 detect_tomcat
 if [ -z ${TOMCAT_VERSION} ]; then
    yaimlog ERROR "Tomcat is probably not installed !"
    yaimlog ERROR "${YERRORSTR}"
    let "ret |= 1"
 fi
 if [ "x${OS_TYPE}" = "xdebian" ]; then
      source /etc/default/${TOMCAT_VERSION}
      yaimgridenv_set CATALINA_HOME "/var/lib/${TOMCAT_VERSION}"
      TOMCAT_SERVER_LIB=$CATALINA_HOME/common
 else # SL
      source /etc/${TOMCAT_VERSION}/${TOMCAT_VERSION}.conf
      source /etc/sysconfig/${TOMCAT_VERSION}
      yaimgridenv_set CATALINA_HOME ${CATALINA_HOME}
      [ -d ${CATALINA_HOME}/server/lib ] && TOMCAT_SERVER_LIB=${CATALINA_HOME}/server/lib
      [ -d ${CATALINA_HOME}/lib ] && TOMCAT_SERVER_LIB=${CATALINA_HOME}/lib
      yaimlog DEBUG "TOMCAT_SERVER_LIB 1111 = $TOMCAT_SERVER_LIB"
 fi

}

