From 31a742d06556b81800212da71c450f0d6afd8f2a Mon Sep 17 00:00:00 2001 From: alba <> Date: Sun, 4 Aug 2002 15:24:50 +0000 Subject: [PATCH] Generating setenv.csh with all variables expanded. --- LDP/lampadas/configure | 45 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/LDP/lampadas/configure b/LDP/lampadas/configure index 45f86165..8702f3a4 100755 --- a/LDP/lampadas/configure +++ b/LDP/lampadas/configure @@ -329,9 +329,9 @@ patch_xsl() } # -# patch_setenv +# patch_setenv_sh # -patch_setenv() +patch_setenv_sh() { local file=$1 local prefix='^[[:space:]]*export[[:space:]]*LAMPADAS_' @@ -350,6 +350,38 @@ patch_setenv() return 0 } +# +# create_setenv_csh +# +create_setenv_csh() +{ + local input=$1 + local output=$2 + local prefix='^[[:space:]]*export[[:space:]]*' + + echo -n "Sourcing in ${input} ... " + ( + . ${input} + echo "Ok." + echo -n "Generating ${output} ... " + + ( + echo "# Generated by configure. Do not modify." + echo "" + sed -ne "s/${prefix}\([[:alnum:]_]*\)=.*/\1/p" \ + < ${input} \ + | while read var + do + echo "setenv ${var} \"${!var}\"" + done + ) > ${output} + + echo "Ok." + return 0 + ) + return 1 +} + # # main # @@ -381,7 +413,7 @@ check_xsltproc check_html_parser check_which count wt2db check_python count -check_python_import os pyPgSQL +check_python_import os pyPgSQL # DateTime if [ ${CHECK_ERROR} -ne 0 ]; then echo "${CHECK_ERROR} errors." @@ -390,8 +422,5 @@ fi echo "No errors." patch_xsl || exit -1 -patch_setenv bin/setenv.sh || exit -1 -echo -e "Creating bin/setenv.csh ... " -sed -e 's/^export/setenv/' -e 's/=/ /' bin/setenv.sh \ -> bin/setenv.csh \ -&& echo "Ok." +patch_setenv_sh bin/setenv.sh || exit -1 +create_setenv_csh bin/setenv.sh bin/setenv.csh || exit -1