From a4b8041c02d131451bcb98583d62a795175ba083 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 31 Dec 2006 01:10:09 +0000 Subject: don't prepend '$HOME' unless the value of the current "$HOME" was actually present. git-svn-id: svn://tug.org/texlive/trunk@3051 c570f23f-e606-0410-a88d-b1316a301751 --- Master/common.sh | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Master/common.sh b/Master/common.sh index e123799703f..d428457eb55 100755 --- a/Master/common.sh +++ b/Master/common.sh @@ -339,20 +339,23 @@ TEXMFCNF__fix_texmf() # # the TEXMFHOME tree if test "x$HOME_CHANGE" = "x1"; then - # if the variable starts with the explicit home of the current user, - # replace that with the string '$HOME' as the explicit home of the - # current user is most certainly not what we want. - HME=`echo "$TEXMFHOME" | sed "s@$HOME/*@@"` - TEXMFHOME="\$HOME/$HME" + + # if the variable starts with the explicit home of the current user + # (as in "/u/karl") replace that with the string '$HOME' as the + # explicit home of the current user is unlikely to ever be right. + if echo "$TEXMFHOME" | grep "$HOME" >/dev/null; then + hme=`echo "$TEXMFHOME" | sed "s,$HOME/*,,"` + TEXMFHOME="\$HOME/$hme" + fi # echo "Setting TEXMFHOME to $TEXMFHOME in $TEXMFCNF_DIR/texmf.cnf... " >&2 - sed "s@^TEXMFHOME.*@TEXMFHOME=$TEXMFHOME@" $TEXMFCNF_DIR/texmf.cnf \ - >.sed_tmp.$$ - cp .sed_tmp.$$ $TEXMFCNF_DIR/texmf.cnf - rm -f .sed_tmp.$$ + sed "s,^TEXMFHOME.*,TEXMFHOME=$TEXMFHOME," $TEXMFCNF_DIR/texmf.cnf \ + >sedtmp.$$ + cp sedtmp.$$ $TEXMFCNF_DIR/texmf.cnf + rm -f sedtmp.$$ fi - echo Done updating texmf.cnf. >&2 + echo "Done updating texmf.cnf." >&2 echo >&2 } -- cgit v1.2.3