Skip to content

Commit

Permalink
GRP-3562: Container stop/start corrupts ENV variables containing doll…
Browse files Browse the repository at this point in the history
…ar sign ($)
  • Loading branch information
credman committed Aug 11, 2021
1 parent 4ac2b73 commit 1955bef
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions container_files/usr-local-bin/librarySetupFiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,16 @@ setupFiles_storeEnvVars() {
echo "#!/bin/sh" > /opt/grouper/grouperEnv.sh
echo "" >> /opt/grouper/grouperEnv.sh

# go through env vars, should start with GROUPER and have an equals sign in there
env | grep "^GROUPER" | grep "=" | sort >> /opt/grouper/grouperEnv.sh

# go through env vars, should start with GROUPER*; this handles quoting but not multiline
export -p | grep "^declare -x GROUPER" | sort >> /opt/grouper/grouperEnv.sh
returnCode=$?
echo "grouperContainer; INFO: (librarySetupFiles.sh-setupFiles_storeEnvVars) env | grep \"^GROUPER\" | grep \"=\" | sort >> /opt/grouper/grouperEnv.sh, result: $returnCode"
echo "grouperContainer; INFO: (librarySetupFiles.sh-setupFiles_storeEnvVars) export -p | grep \"^declare -x GROUPER\" | sort >> /opt/grouper/grouperEnv.sh, result: $returnCode"
if [ $returnCode != 0 ]; then exit $returnCode; fi

sed -i "s|^GROUPER|export GROUPER|g" /opt/grouper/grouperEnv.sh
# declare -x exports to the current and child processes, but not globally to the procid=1 process; `export` works, as well as `declare -x -g`
sed -i "s|^declare -x |export |" /opt/grouper/grouperEnv.sh
returnCode=$?
echo "grouperContainer; INFO: (librarySetupFiles.sh-setupFiles_storeEnvVars) sed -i \"s|^GROUPER|export GROUPER|g\" /opt/grouper/grouperEnv.sh , result: $returnCode"
echo "grouperContainer; INFO: (librarySetupFiles.sh-setupFiles_storeEnvVars) sed -i \"s|^declare -x |export |\" /opt/grouper/grouperEnv.sh, result: $returnCode"
if [ $returnCode != 0 ]; then exit $returnCode; fi

if [ ! -f /home/tomcat/.bashrc ]
Expand Down

0 comments on commit 1955bef

Please sign in to comment.