summaryrefslogtreecommitdiff
path: root/Build/source/selfautofix
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-16 00:03:16 +0000
committerKarl Berry <karl@freefriends.org>2006-01-16 00:03:16 +0000
commitcc68d22a4a87ea77bf2ea82288854d2abcfc1f3d (patch)
tree155cb9cab56d69e677bbc2b11edae71cead67b5f /Build/source/selfautofix
parent269d9a5ff80f6f2e0279be58cf9b09f4e5ed86fa (diff)
from TeX
git-svn-id: svn://tug.org/texlive/trunk@1480 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/selfautofix')
-rwxr-xr-xBuild/source/selfautofix34
1 files changed, 34 insertions, 0 deletions
diff --git a/Build/source/selfautofix b/Build/source/selfautofix
new file mode 100755
index 00000000000..2aa08b49855
--- /dev/null
+++ b/Build/source/selfautofix
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+# selfautofix: change absolute paths in texmf.cnf to $SELFAUTO references.
+# Copyright: 1998, Thomas Esser. Public domain.
+
+bindir=$1
+web2c=$2
+
+test -f "$web2c"/texmf.cnf || exit 0
+grep 'original texmf.cnf --' "$web2c"/texmf.cnf >/dev/null 2>&1 || exit 0
+
+bindirp=`echo $bindir | sed 's%/[^/][^/]*$%%'`
+bindirpp=`echo $bindirp | sed 's%/[^/][^/]*$%%'`
+
+cd $web2c || exit 0
+
+sedfile=sed.$$
+test -n "$bindir" \
+ && echo "/^[ ]*TEXMFCNF[ =]/!s%$bindir/%\$SELFAUTOLOC/%g" > $sedfile
+test -n "$bindirp" \
+ && echo "/^[ ]*TEXMFCNF[ =]/!s%$bindirp/%\$SELFAUTODIR/%g" >> $sedfile
+test -n "$bindirpp" \
+ && echo "/^[ ]*TEXMFCNF[ =]/!s%$bindirpp/%\$SELFAUTOPARENT/%g" >> $sedfile
+
+cat >>$sedfile <<eof
+/^%/!s%:%;%g
+/^[ ]*TEXMFCNF[ =]/s%;%:%g
+eof
+
+sed -f $sedfile texmf.cnf >texmf.cnf.$$
+test -s texmf.cnf.$$ && cat texmf.cnf.$$ > texmf.cnf
+rm -f texmf.cnf.$$ $sedfile
+
+exit 0