- modify salome.(c)sh and env_products.(c)sh: add commands to clean duplication from the environment variables (PATH, LD_LIBRARY_PATH, PYTHONPATH, LD_RUN_PATH) and use these commands to process environment where it is needed;
- exclude non-existing directories from environment variables.
export COMPONENT_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
export PATH=\${COMPONENT_ROOT_DIR}/bin/salome:\${PATH}
export LD_LIBRARY_PATH=\${COMPONENT_ROOT_DIR}/lib/salome:\${LD_LIBRARY_PATH}
-export PYTHONPATH=\${COMPONENT_ROOT_DIR}/bin/salome:\${PYTHONPATH}
-export PYTHONPATH=\${COMPONENT_ROOT_DIR}/lib/salome:\${PYTHONPATH}
-export PYTHONPATH=\${COMPONENT_ROOT_DIR}/lib/python2.2/site-packages/salome:\${PYTHONPATH}
-export PYTHONPATH=\${COMPONENT_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
+export PYTHONPATH=\${COMPONENT_ROOT_DIR}/bin/salome:\${COMPONENT_ROOT_DIR}/lib/salome:\${COMPONENT_ROOT_DIR}/lib/python2.2/site-packages/salome:\${COMPONENT_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
##
EOF
(test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
export COMPONENT_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
export PATH=\${COMPONENT_ROOT_DIR}/bin/salome:\${PATH}
export LD_LIBRARY_PATH=\${COMPONENT_ROOT_DIR}/lib/salome:\${LD_LIBRARY_PATH}
-export PYTHONPATH=\${COMPONENT_ROOT_DIR}/bin/salome:\${PYTHONPATH}
-export PYTHONPATH=\${COMPONENT_ROOT_DIR}/lib/salome:\${PYTHONPATH}
-export PYTHONPATH=\${COMPONENT_ROOT_DIR}/lib/python2.2/site-packages/salome:\${PYTHONPATH}
-export PYTHONPATH=\${COMPONENT_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
+export PYTHONPATH=\${COMPONENT_ROOT_DIR}/bin/salome:\${COMPONENT_ROOT_DIR}/lib/salome:\${COMPONENT_ROOT_DIR}/lib/python2.2/site-packages/salome:\${COMPONENT_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
##
EOF
make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
export GEOM_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
export PATH=\${GEOM_ROOT_DIR}/bin/salome:\${PATH}
export LD_LIBRARY_PATH=\${GEOM_ROOT_DIR}/lib/salome:\${LD_LIBRARY_PATH}
-export PYTHONPATH=\${GEOM_ROOT_DIR}/bin/salome:\${PYTHONPATH}
-export PYTHONPATH=\${GEOM_ROOT_DIR}/lib/salome:\${PYTHONPATH}
-export PYTHONPATH=\${GEOM_ROOT_DIR}/lib/python2.2/site-packages/salome:\${PYTHONPATH}
-export PYTHONPATH=\${GEOM_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
+export PYTHONPATH=\${GEOM_ROOT_DIR}/bin/salome:\${GEOM_ROOT_DIR}/lib/salome:\${GEOM_ROOT_DIR}/lib/python2.2/site-packages/salome:\${GEOM_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
##
EOF
(test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
export GEOM_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
export PATH=\${GEOM_ROOT_DIR}/bin/salome:\${PATH}
export LD_LIBRARY_PATH=\${GEOM_ROOT_DIR}/lib/salome:\${LD_LIBRARY_PATH}
-export PYTHONPATH=\${GEOM_ROOT_DIR}/bin/salome:\${PYTHONPATH}
-export PYTHONPATH=\${GEOM_ROOT_DIR}/lib/salome:\${PYTHONPATH}
-export PYTHONPATH=\${GEOM_ROOT_DIR}/lib/python2.2/site-packages/salome:\${PYTHONPATH}
-export PYTHONPATH=\${GEOM_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
+export PYTHONPATH=\${GEOM_ROOT_DIR}/bin/salome:\${GEOM_ROOT_DIR}/lib/salome:\${GEOM_ROOT_DIR}/lib/python2.2/site-packages/salome:\${GEOM_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
##
EOF
make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
#$DELIM ${PRODUCT_TYPE} $DELIM
export GHS3DPLUGIN_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
-export PATH=\${GHS3DPLUGIN_ROOT_DIR}/bin/salome:\${PATH}
export LD_LIBRARY_PATH=\${GHS3DPLUGIN_ROOT_DIR}/lib/salome:\${LD_LIBRARY_PATH}
-export PYTHONPATH=\${GHS3DPLUGIN_ROOT_DIR}/bin/salome:\${PYTHONPATH}
-export PYTHONPATH=\${GHS3DPLUGIN_ROOT_DIR}/lib/salome:\${PYTHONPATH}
-export PYTHONPATH=\${GHS3DPLUGIN_ROOT_DIR}/lib/python2.2/site-packages/salome:\${PYTHONPATH}
-export PYTHONPATH=\${GHS3DPLUGIN_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
+export PYTHONPATH=\${GHS3DPLUGIN_ROOT_DIR}/lib/salome:\${GHS3DPLUGIN_ROOT_DIR}/lib/python2.2/site-packages/salome:\${PYTHONPATH}
##
EOF
(test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
#$DELIM ${PRODUCT_TYPE} $DELIM
export GHS3DPLUGIN_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
-export PATH=\${GHS3DPLUGIN_ROOT_DIR}/bin/salome:\${PATH}
export LD_LIBRARY_PATH=\${GHS3DPLUGIN_ROOT_DIR}/lib/salome:\${LD_LIBRARY_PATH}
-export PYTHONPATH=\${GHS3DPLUGIN_ROOT_DIR}/bin/salome:\${PYTHONPATH}
-export PYTHONPATH=\${GHS3DPLUGIN_ROOT_DIR}/lib/salome:\${PYTHONPATH}
-export PYTHONPATH=\${GHS3DPLUGIN_ROOT_DIR}/lib/python2.2/site-packages/salome:\${PYTHONPATH}
-export PYTHONPATH=\${GHS3DPLUGIN_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
+export PYTHONPATH=\${GHS3DPLUGIN_ROOT_DIR}/lib/salome:\${GHS3DPLUGIN_ROOT_DIR}/lib/python2.2/site-packages/salome:\${PYTHONPATH}
##
EOF
make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
export KERNEL_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
export PATH=\${KERNEL_ROOT_DIR}/bin/salome:\${PATH}
export LD_LIBRARY_PATH=\${KERNEL_ROOT_DIR}/lib/salome:\${LD_LIBRARY_PATH}
-export PYTHONPATH=\${KERNEL_ROOT_DIR}/bin/salome:\${PYTHONPATH}
-export PYTHONPATH=\${KERNEL_ROOT_DIR}/lib/salome:\${PYTHONPATH}
-export PYTHONPATH=\${KERNEL_ROOT_DIR}/lib/python2.2/site-packages/salome:\${PYTHONPATH}
-export PYTHONPATH=\${KERNEL_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
+export PYTHONPATH=\${KERNEL_ROOT_DIR}/bin/salome:\${KERNEL_ROOT_DIR}/lib/salome:\${KERNEL_ROOT_DIR}/lib/python2.2/site-packages/salome:\${KERNEL_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
##
EOF
(test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
export KERNEL_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
export PATH=\${KERNEL_ROOT_DIR}/bin/salome:\${PATH}
export LD_LIBRARY_PATH=\${KERNEL_ROOT_DIR}/lib/salome:\${LD_LIBRARY_PATH}
-export PYTHONPATH=\${KERNEL_ROOT_DIR}/bin/salome:\${PYTHONPATH}
-export PYTHONPATH=\${KERNEL_ROOT_DIR}/lib/salome:\${PYTHONPATH}
-export PYTHONPATH=\${KERNEL_ROOT_DIR}/lib/python2.2/site-packages/salome:\${PYTHONPATH}
-export PYTHONPATH=\${KERNEL_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
+export PYTHONPATH=\${KERNEL_ROOT_DIR}/bin/salome:\${KERNEL_ROOT_DIR}/lib/salome:\${KERNEL_ROOT_DIR}/lib/python2.2/site-packages/salome:\${KERNEL_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
##
EOF
make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
export MED_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
export PATH=\${MED_ROOT_DIR}/bin/salome:\${PATH}
export LD_LIBRARY_PATH=\${MED_ROOT_DIR}/lib/salome:\${LD_LIBRARY_PATH}
-export PYTHONPATH=\${MED_ROOT_DIR}/bin/salome:\${PYTHONPATH}
-export PYTHONPATH=\${MED_ROOT_DIR}/lib/salome:\${PYTHONPATH}
-export PYTHONPATH=\${MED_ROOT_DIR}/lib/python2.2/site-packages/salome:\${PYTHONPATH}
-export PYTHONPATH=\${MED_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
+export PYTHONPATH=\${MED_ROOT_DIR}/bin/salome:\${MED_ROOT_DIR}/lib/salome:\${MED_ROOT_DIR}/lib/python2.2/site-packages/salome:\${MED_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
##
EOF
(test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
export MED_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
export PATH=\${MED_ROOT_DIR}/bin/salome:\${PATH}
export LD_LIBRARY_PATH=\${MED_ROOT_DIR}/lib/salome:\${LD_LIBRARY_PATH}
-export PYTHONPATH=\${MED_ROOT_DIR}/bin/salome:\${PYTHONPATH}
-export PYTHONPATH=\${MED_ROOT_DIR}/lib/salome:\${PYTHONPATH}
-export PYTHONPATH=\${MED_ROOT_DIR}/lib/python2.2/site-packages/salome:\${PYTHONPATH}
-export PYTHONPATH=\${MED_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
+export PYTHONPATH=\${MED_ROOT_DIR}/bin/salome:\${MED_ROOT_DIR}/lib/salome:\${MED_ROOT_DIR}/lib/python2.2/site-packages/salome:\${MED_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
##
EOF
make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
#$DELIM ${PRODUCT_TYPE} $DELIM
export NETGENPLUGIN_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
-export PATH=\${NETGENPLUGIN_ROOT_DIR}/bin/salome:\${PATH}
export LD_LIBRARY_PATH=\${NETGENPLUGIN_ROOT_DIR}/lib/salome:\${LD_LIBRARY_PATH}
-export PYTHONPATH=\${NETGENPLUGIN_ROOT_DIR}/bin/salome:\${PYTHONPATH}
-export PYTHONPATH=\${NETGENPLUGIN_ROOT_DIR}/lib/salome:\${PYTHONPATH}
-export PYTHONPATH=\${NETGENPLUGIN_ROOT_DIR}/lib/python2.2/site-packages/salome:\${PYTHONPATH}
-export PYTHONPATH=\${NETGENPLUGIN_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
+export PYTHONPATH=\${NETGENPLUGIN_ROOT_DIR}/lib/salome:\${NETGENPLUGIN_ROOT_DIR}/lib/python2.2/site-packages/salome:\${PYTHONPATH}
##
EOF
(test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
#$DELIM ${PRODUCT_TYPE} $DELIM
export NETGENPLUGIN_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
-export PATH=\${NETGENPLUGIN_ROOT_DIR}/bin/salome:\${PATH}
export LD_LIBRARY_PATH=\${NETGENPLUGIN_ROOT_DIR}/lib/salome:\${LD_LIBRARY_PATH}
-export PYTHONPATH=\${NETGENPLUGIN_ROOT_DIR}/bin/salome:\${PYTHONPATH}
-export PYTHONPATH=\${NETGENPLUGIN_ROOT_DIR}/lib/salome:\${PYTHONPATH}
-export PYTHONPATH=\${NETGENPLUGIN_ROOT_DIR}/lib/python2.2/site-packages/salome:\${PYTHONPATH}
-export PYTHONPATH=\${NETGENPLUGIN_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
+export PYTHONPATH=\${NETGENPLUGIN_ROOT_DIR}/lib/salome:\${NETGENPLUGIN_ROOT_DIR}/lib/python2.2/site-packages/salome:\${PYTHONPATH}
##
EOF
make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
#$DELIM ${PRODUCT_TYPE} $DELIM
export PYCALCULATOR_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
export PATH=\${PYCALCULATOR_ROOT_DIR}/bin/salome:\${PATH}
-export LD_LIBRARY_PATH=\${PYCALCULATOR_ROOT_DIR}/lib/salome:\${LD_LIBRARY_PATH}
-export PYTHONPATH=\${PYCALCULATOR_ROOT_DIR}/bin/salome:\${PYTHONPATH}
-export PYTHONPATH=\${PYCALCULATOR_ROOT_DIR}/lib/salome:\${PYTHONPATH}
-export PYTHONPATH=\${PYCALCULATOR_ROOT_DIR}/lib/python2.2/site-packages/salome:\${PYTHONPATH}
-export PYTHONPATH=\${PYCALCULATOR_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
+export PYTHONPATH=\${PYCALCULATOR_ROOT_DIR}/bin/salome:\${PYCALCULATOR_ROOT_DIR}/lib/python2.2/site-packages/salome:\${PYTHONPATH}
##
EOF
(test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
#$DELIM ${PRODUCT_TYPE} $DELIM
export PYCALCULATOR_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
export PATH=\${PYCALCULATOR_ROOT_DIR}/bin/salome:\${PATH}
-export LD_LIBRARY_PATH=\${PYCALCULATOR_ROOT_DIR}/lib/salome:\${LD_LIBRARY_PATH}
-export PYTHONPATH=\${PYCALCULATOR_ROOT_DIR}/bin/salome:\${PYTHONPATH}
-export PYTHONPATH=\${PYCALCULATOR_ROOT_DIR}/lib/salome:\${PYTHONPATH}
-export PYTHONPATH=\${PYCALCULATOR_ROOT_DIR}/lib/python2.2/site-packages/salome:\${PYTHONPATH}
-export PYTHONPATH=\${PYCALCULATOR_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
+export PYTHONPATH=\${PYCALCULATOR_ROOT_DIR}/bin/salome:\${PYCALCULATOR_ROOT_DIR}/lib/python2.2/site-packages/salome:\${PYTHONPATH}
##
EOF
make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
export SMESH_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
export PATH=\${SMESH_ROOT_DIR}/bin/salome:\${PATH}
export LD_LIBRARY_PATH=\${SMESH_ROOT_DIR}/lib/salome:\${LD_LIBRARY_PATH}
-export PYTHONPATH=\${SMESH_ROOT_DIR}/bin/salome:\${PYTHONPATH}
-export PYTHONPATH=\${SMESH_ROOT_DIR}/lib/salome:\${PYTHONPATH}
-export PYTHONPATH=\${SMESH_ROOT_DIR}/lib/python2.2/site-packages/salome:\${PYTHONPATH}
-export PYTHONPATH=\${SMESH_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
+export PYTHONPATH=\${SMESH_ROOT_DIR}/bin/salome:\${SMESH_ROOT_DIR}/lib/salome:\${SMESH_ROOT_DIR}/lib/python2.2/site-packages/salome:\${SMESH_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
##
EOF
(test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
export SMESH_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
export PATH=\${SMESH_ROOT_DIR}/bin/salome:\${PATH}
export LD_LIBRARY_PATH=\${SMESH_ROOT_DIR}/lib/salome:\${LD_LIBRARY_PATH}
-export PYTHONPATH=\${SMESH_ROOT_DIR}/bin/salome:\${PYTHONPATH}
-export PYTHONPATH=\${SMESH_ROOT_DIR}/lib/salome:\${PYTHONPATH}
-export PYTHONPATH=\${SMESH_ROOT_DIR}/lib/python2.2/site-packages/salome:\${PYTHONPATH}
-export PYTHONPATH=\${SMESH_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
+export PYTHONPATH=\${SMESH_ROOT_DIR}/bin/salome:\${SMESH_ROOT_DIR}/lib/salome:\${SMESH_ROOT_DIR}/lib/python2.2/site-packages/salome:\${SMESH_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
##
EOF
make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
export SUPERV_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
export PATH=\${SUPERV_ROOT_DIR}/bin/salome:\${PATH}
export LD_LIBRARY_PATH=\${SUPERV_ROOT_DIR}/lib/salome:\${LD_LIBRARY_PATH}
-export PYTHONPATH=\${SUPERV_ROOT_DIR}/bin/salome:\${PYTHONPATH}
-export PYTHONPATH=\${SUPERV_ROOT_DIR}/lib/salome:\${PYTHONPATH}
-export PYTHONPATH=\${SUPERV_ROOT_DIR}/lib/python2.2/site-packages/salome:\${PYTHONPATH}
-export PYTHONPATH=\${SUPERV_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
+export PYTHONPATH=\${SUPERV_ROOT_DIR}/bin/salome:\${SUPERV_ROOT_DIR}/lib/salome:\${SUPERV_ROOT_DIR}/lib/python2.2/site-packages/salome:\${SUPERV_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
##
EOF
(test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
export SUPERV_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
export PATH=\${SUPERV_ROOT_DIR}/bin/salome:\${PATH}
export LD_LIBRARY_PATH=\${SUPERV_ROOT_DIR}/lib/salome:\${LD_LIBRARY_PATH}
-export PYTHONPATH=\${SUPERV_ROOT_DIR}/bin/salome:\${PYTHONPATH}
-export PYTHONPATH=\${SUPERV_ROOT_DIR}/lib/salome:\${PYTHONPATH}
-export PYTHONPATH=\${SUPERV_ROOT_DIR}/lib/python2.2/site-packages/salome:\${PYTHONPATH}
-export PYTHONPATH=\${SUPERV_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
+export PYTHONPATH=\${SUPERV_ROOT_DIR}/bin/salome:\${SUPERV_ROOT_DIR}/lib/salome:\${SUPERV_ROOT_DIR}/lib/python2.2/site-packages/salome:\${SUPERV_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
##
EOF
make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
export VISU_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
export PATH=\${VISU_ROOT_DIR}/bin/salome:\${PATH}
export LD_LIBRARY_PATH=\${VISU_ROOT_DIR}/lib/salome:\${LD_LIBRARY_PATH}
-export PYTHONPATH=\${VISU_ROOT_DIR}/bin/salome:\${PYTHONPATH}
-export PYTHONPATH=\${VISU_ROOT_DIR}/lib/salome:\${PYTHONPATH}
-export PYTHONPATH=\${VISU_ROOT_DIR}/lib/python2.2/site-packages/salome:\${PYTHONPATH}
-export PYTHONPATH=\${VISU_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
+export PYTHONPATH=\${VISU_ROOT_DIR}/bin/salome:\${VISU_ROOT_DIR}/lib/salome:\${VISU_ROOT_DIR}/lib/python2.2/site-packages/salome:\${VISU_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
##
EOF
(test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
export VISU_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
export PATH=\${VISU_ROOT_DIR}/bin/salome:\${PATH}
export LD_LIBRARY_PATH=\${VISU_ROOT_DIR}/lib/salome:\${LD_LIBRARY_PATH}
-export PYTHONPATH=\${VISU_ROOT_DIR}/bin/salome:\${PYTHONPATH}
-export PYTHONPATH=\${VISU_ROOT_DIR}/lib/salome:\${PYTHONPATH}
-export PYTHONPATH=\${VISU_ROOT_DIR}/lib/python2.2/site-packages/salome:\${PYTHONPATH}
-export PYTHONPATH=\${VISU_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
+export PYTHONPATH=\${VISU_ROOT_DIR}/bin/salome:\${VISU_ROOT_DIR}/lib/salome:\${VISU_ROOT_DIR}/lib/python2.2/site-packages/salome:\${VISU_ROOT_DIR}/lib/python2.2/site-packages/salome/shared_modules:\${PYTHONPATH}
##
EOF
make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
product_env=${install_work}/env_${product_name}.sh
(test -e ${product_env} && rm ${product_env} )
fi
-
+### !!! writing salome.sh file !!! -> add global functions
cat >> ${install_work}/$SHRC <<EOF
export INSTALL_ROOT=${install_root}
+#$DELIM globals $DELIM
+setenvp() {
+ xenv=\$2:\`printenv \$1\`
+ out_var=\`echo \$xenv | awk -F: '{n=0 ; for(i=1;i<=NF;i++){v=\$i;t=1;for(j=0;j<=n;j++){if(keys[j]==v){t=0;break;}};if(t)keys[n++]=v} ; for(j=0;j<n;j++){printf "%s",keys[j];if(j<n-1) printf ":"} ; printf "\n"}'\`
+ export \$1=\$out_var
+}
+
+setenva() {
+ xenv=\`printenv \$1\`:\$2
+ out_var=\`echo \$xenv | awk -F: '{n=0 ; for(i=NF;i>=1;i--){v=\$i;t=1;for(j=0;j<=n;j++){if(keys[j]==v){t=0;break;}};if(t)keys[n++]=v} ; for(j=n-1;j>=0;j--){printf "%s",keys[j];if(j>0) printf ":"} ; printf "\n"}'\`
+ export \$1=\$out_var
+}
EOF
-product_sequence="$2"
-#for i in `ls -a ${install_work} | grep -E "..*" | grep -v ".salome.*"` ; do
-for i in $product_sequence ; do
- cat ${install_work}/env_${i}.sh >> ${install_work}/$SHRC 2>/dev/null
-done
+### !!! writing salome.csh file !!! -> add global aliases
+cat >> ${install_work}/$CSHRC <<EOF
+setenv INSTALL_ROOT ${install_root}
+#$DELIM globals $DELIM
+alias cleandup "echo \!:1 | awk -F: '"'{n=0 ; for(i=1;i<=NF;i++){v=\$i;t=1;for(j=0;j<=n;j++){if(keys[j]==v){t=0;break;}};if(t)keys[n++]=v} ; for(j=0;j<n;j++){printf "%s",keys[j];if(j<n-1) printf ":"} ; printf "\n"}'"'"
+alias cleandupr "echo \!:1 | awk -F: '"'{n=0 ; for(i=NF;i>=1;i--){v=\$i;t=1;for(j=0;j<=n;j++){if(keys[j]==v){t=0;break;}};if(t)keys[n++]=v} ; for(j=n-1;j>=0;j--){printf "%s",keys[j];if(j>0) printf ":"} ; printf "\n"}'"'"
-sed -e 's%^export \([[:alnum:]_[:blank:]]*\)\=%setenv \1 %g' -e 's%^#csh-specific %%g' ${INSTALL_WORK}/$SHRC > ${INSTALL_WORK}/_$CSHRC
+alias setenva 'set a="\!:1" ; set b=\`printenv \$a\`:"'\!:2'" ; set b=\`cleandupr \$b\` ; setenv \$a \$b ; unset a, b'
+alias setenvp 'set a="\!:1" ; set b="'\!:2'":\`printenv \$a\` ; set b=\`cleandup \$b\` ; setenv \$a \$b ; unset a, b'
+EOF
+### !!! writing salome.csh file !!! -> set inital variables
pre_vars="PATH LD_LIBRARY_PATH LD_RUN_PATH PYTHONPATH"
for i in $pre_vars ; do
cat >> ${install_work}/$CSHRC <<EOF
+#$DELIM initial settings $DELIM
if (! (\$?${i}) ) then
setenv $i
endif
EOF
done
-cat ${INSTALL_WORK}/_$CSHRC >> ${INSTALL_WORK}/$CSHRC
-rm -f ${INSTALL_WORK}/_$CSHRC
+### !!! writing salome.(c)sh files !!! -> dump products environment files, changing 'export' by 'setenv(a|b)' where necessary
+product_sequence="$2"
+for i in $product_sequence ; do
+ sed -e 's%^export\([[:blank:]]*\)PATH=\$[{]\?PATH[}]\?:\(.*\)%setenva\1PATH \2%g' -e 's%^export\([[:blank:]]*\)PATH=\(.*\):\$[{]\?PATH[}]\?%setenvp\1PATH \2%g' ${install_work}/env_${i}.sh > ${INSTALL_WORK}/_tmp1 2>/dev/null
+ sed -e 's%^export\([[:blank:]]*\)LD_LIBRARY_PATH=\$[{]\?LD_LIBRARY_PATH[}]\?:\(.*\)%setenva\1LD_LIBRARY_PATH \2%g' -e 's%^export\([[:blank:]]*\)LD_LIBRARY_PATH=\(.*\):\$[{]\?LD_LIBRARY_PATH[}]\?%setenvp\1LD_LIBRARY_PATH \2%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
+ sed -e 's%^export\([[:blank:]]*\)PYTHONPATH=\$[{]\?PYTHONPATH[}]\?:\(.*\)%setenva\1PYTHONPATH \2%g' -e 's%^export\([[:blank:]]*\)PYTHONPATH=\(.*\):\$[{]\?PYTHONPATH[}]\?%setenvp\1PYTHONPATH \2%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
+ sed -e 's%^export\([[:blank:]]*\)LD_RUN_PATH=\$[{]\?LD_RUN_PATH[}]\?:\(.*\)%setenva\1LD_RUN_PATH \2%g' -e 's%^export\([[:blank:]]*\)LD_RUN_PATH=\(.*\):\$[{]\?LD_RUN_PATH[}]\?%setenvp\1LD_RUN_PATH \2%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
+ cat ${INSTALL_WORK}/_tmp2 >> ${install_work}/$SHRC 2>/dev/null
+
+ sed -e 's%^export \([[:alnum:]_[:blank:]]*\)\=%setenv \1 %g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
+ cat ${INSTALL_WORK}/_tmp1 >> ${install_work}/$CSHRC 2>/dev/null
+
+ rm -f ${INSTALL_WORK}/_tmp1 ${INSTALL_WORK}/_tmp2
+done
if [ $# -eq 4 ] ; then
product_dir=$4