/[pdpsoft]/trunk/grid-mw-security/glexec/util/wrap-env-var/old/unwrap-wrap-glexec-env.sh
ViewVC logotype

Annotation of /trunk/grid-mw-security/glexec/util/wrap-env-var/old/unwrap-wrap-glexec-env.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 365 - (hide annotations) (download) (as text)
Mon Jun 1 17:36:42 2009 UTC (13 years, 3 months ago) by okoeroo
Original Path: trunk/grid-mw-security/glexec/util/wrap-env-var/unwrap-wrap-glexec-env.sh
File MIME type: application/x-shellscript
File size: 1557 byte(s)
Adding my gLExec environment variables wrap and unwrap scripts a pilot job framework examples.



1 okoeroo 365 #!/bin/sh
2    
3     function unwrap_env () {
4     # Setting new break characters
5     PRESERVED_IFS=$IFS
6     IFS=`echo -en "\n\b"`
7     for i in `printenv`; do
8     # Unwrap the GLEXEC_WRAP_ environment variables
9     if [ "`expr substr $i 1 12`" == "GLEXEC_WRAP_" ]; then # substring match and compare to "GLEXEC_WRAP_"
10     # D=`echo "$i" | sed -e 's/^GLEXEC_WRAP_\([a-zA-Z0-9_]*\)=\(.*\)/\1=\2/'`
11     # E=`echo "$i" | sed -e 's/\(^GLEXEC_WRAP_[a-zA-Z0-9_][a-zA-Z0-9_]*\)=.*/\1/'`
12     D=`echo "$i" | expr match "$i" 'GLEXEC_WRAP_\([a-zA-Z0-9_]*=.*\)'` # Match string excluding the GLEXEC_WRAP_ prefix
13     E=`echo "$i" | expr match "$i" '\(GLEXEC_WRAP_[a-zA-Z0-9_]*\)'` # Match string including the GLEXEC_WRAP_ prefix
14    
15     # Clean the environment option prefixed by GLEXEC_WRAP_
16     unset $E
17    
18     # Prevent this list of environment variables which are set by gLExec to be overwritten by the wrapped environment variables
19     if [ "$E" == "GLEXEC_WRAP_HOME" ]; then continue; fi # The $HOME is set by gLExec to the mapped account
20     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
21    
22     # Export the unwrapped environment variables
23     export $D
24     fi
25     done
26     IFS=$PRESERVED_IFS
27     }
28    
29     echo "----- fire $0 : unwrap_env -------"
30     unwrap_env
31    
32     echo "----- fire $0 : printenv -------"
33     printenv

Properties

Name Value
svn:executable *

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28