#!/bin/sh function unwrap_env () { # Setting new break characters PRESERVED_IFS=$IFS IFS=`echo -en "\n\b"` for i in `printenv`; do # Unwrap the GLEXEC_WRAP_ environment variables if [ "`expr substr $i 1 12`" == "GLEXEC_WRAP_" ]; then # substring match and compare to "GLEXEC_WRAP_" # D=`echo "$i" | sed -e 's/^GLEXEC_WRAP_\([a-zA-Z0-9_]*\)=\(.*\)/\1=\2/'` # E=`echo "$i" | sed -e 's/\(^GLEXEC_WRAP_[a-zA-Z0-9_][a-zA-Z0-9_]*\)=.*/\1/'` D=`echo "$i" | expr match "$i" 'GLEXEC_WRAP_\([a-zA-Z0-9_]*=.*\)'` # Match string excluding the GLEXEC_WRAP_ prefix E=`echo "$i" | expr match "$i" '\(GLEXEC_WRAP_[a-zA-Z0-9_]*\)'` # Match string including the GLEXEC_WRAP_ prefix # Clean the environment option prefixed by GLEXEC_WRAP_ unset $E # Prevent this list of environment variables which are set by gLExec to be overwritten by the wrapped environment variables if [ "$E" == "GLEXEC_WRAP_HOME" ]; then continue; fi # The $HOME is set by gLExec to the mapped account if [ "$E" == "GLEXEC_WRAP_X509_USER_PROXY" ]; then continue; fi # The $X509_USER_PROXY is set by gLExec to the default target location of the proxy or to the $GLEXEC_TARGET_PROXY # Export the unwrapped environment variables export $D fi done IFS=$PRESERVED_IFS } echo "----- fire $0 : unwrap_env -------" unwrap_env echo "----- fire $0 : printenv -------" printenv