Fix for Patch #1682: Moved from one wrapper for all services to one wrapper file...
authorMaria Alandes Pradillo <Maria.Alandes.Pradillo@cern.ch>
Wed, 5 Mar 2008 10:22:06 +0000 (10:22 +0000)
committerMaria Alandes Pradillo <Maria.Alandes.Pradillo@cern.ch>
Wed, 5 Mar 2008 10:22:06 +0000 (10:22 +0000)
org.glite.yaim.myproxy/config/functions/config_info_service_px

index ed503f5..1bbb0ee 100644 (file)
@@ -39,13 +39,17 @@ config_info_service_px_setenv () {
 
 config_info_service_px () {
 
-INFO_SERVICE_SCRIPT=${INFO_SERVICE_SCRIPT:-${INSTALL_ROOT}/glite/libexec}
 INFO_SERVICE_CONFIG=${INFO_SERVICE_CONFIG:-${INSTALL_ROOT}/glite/etc}
+INFO_SERVICE_SCRIPT=${INFO_SERVICE_SCRIPT:-${INSTALL_ROOT}/glite/libexec}
 INFO_PROVIDER_PATH=${INFO_PROVIDER_PATH:-${INSTALL_ROOT}/glite/etc/gip/provider}
-SERVICE=myproxy
 
-if [ ! -f ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE}.conf.template ]; then
-  yaimlog ERROR "The template file for glite-info-service-${SERVICE}.conf.template was not found in ${INFO_SERVICE_CONFIG}."
+SERVICE=MYPROXY
+SERVICE_HOST=${PX_HOST}
+
+SERVICE_LC=`echo ${SERVICE} | tr '[:upper:]' '[:lower:]'`
+
+if [ ! -f ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE_LC}.conf.template ]; then
+  yaimlog ERROR "The template file for glite-info-service-${SERVICE_LC}.conf.template was not found in ${INFO_SERVICE_CONFIG}."
   exit 1
 fi
 
@@ -54,31 +58,31 @@ if [ ! -f ${INFO_SERVICE_SCRIPT}/glite-info-service ]; then
   exit 1
 fi
 
-rm -rf ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE}.conf
-cp ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE}.conf.template ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE}.conf
+yaimlog DEBUG "Delete a previous version of the glite-info-service-${SERVICE_LC}.conf if it exists"
+rm -rf ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE_LC}.conf
 
-if [ -f ${INFO_PROVIDER_PATH}/glite-info-provider-service-wrapper ]; then 
-  grep -q glite-info-service-${SERVICE}.conf ${INFO_PROVIDER_PATH}/glite-info-provider-service-wrapper >> /dev/null
-  res=$?
-  if [ $res -eq 1 ]; then  
-    cat << EOF > ${INFO_PROVIDER_PATH}/glite-info-provider-service-wrapper
-#!/bin/sh
-export PATH=$PATH:${INFO_SERVICE_SCRIPT}
-${INFO_SERVICE_SCRIPT}/glite-info-service ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE}.conf $SITE_NAME
-EOF
-    chmod +x ${INFO_PROVIDER_PATH}/glite-info-provider-service-wrapper 
-  fi
-else
-  cat << EOF > ${INFO_PROVIDER_PATH}/glite-info-provider-service-wrapper
+yaimlog DEBUG "Create the glite-info-service-${SERVICE_LC}.conf file out of the template file"
+cp ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE_LC}.conf.template ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE_LC}.conf
+
+# Note: the configuration file may need to be altered if non standard values have been used. 
+
+yaimlog DEBUG "Delete a previous version of the glite-info-provider-service-${SERVICE_LC}-wrapper if it exists"
+rm -rf ${INFO_PROVIDER_PATH}/glite-info-provider-service-${SERVICE_LC}-wrapper
+
+yaimlog DEBUG "Create the ${INFO_PROVIDER_PATH} in case it doesn't exist"
+mkdir -p ${INFO_PROVIDER_PATH} 
+
+yaimlog DEBUG "Create the glite-info-provider-service-${SERVICE_LC}-wrapper file"
+cat << EOF > ${INFO_PROVIDER_PATH}/glite-info-provider-service-${SERVICE_LC}-wrapper
 #!/bin/sh
 export PATH=$PATH:${INFO_SERVICE_SCRIPT}
-${INFO_SERVICE_SCRIPT}/glite-info-service ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE}.conf $SITE_NAME
+export ${SERVICE}_HOST=${SERVICE_HOST}
+${INFO_SERVICE_SCRIPT}/glite-info-service ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE_LC}.conf $SITE_NAME
 EOF
-  chmod +x ${INFO_PROVIDER_PATH}/glite-info-provider-service-wrapper
-fi
+
+chmod +x ${INFO_PROVIDER_PATH}/glite-info-provider-service-${SERVICE_LC}-wrapper 
  
   
-# Exit with success
 return 0
 
 }