From 091ab8ca57bae0d756c14fa66f6fb64151091bd9 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 2 Jan 2006 23:53:48 +0000 Subject: trunk/Master/texmf/texconfig git-svn-id: svn://tug.org/texlive/trunk@35 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf/texconfig/README | 23 +++ Master/texmf/texconfig/g/generic | Bin 0 -> 981 bytes Master/texmf/texconfig/generic | 10 + Master/texmf/texconfig/tcfmgr | 385 ++++++++++++++++++++++++++++++++++++++ Master/texmf/texconfig/tcfmgr.map | 10 + Master/texmf/texconfig/v/vt100 | Bin 0 -> 1230 bytes Master/texmf/texconfig/x/xterm | Bin 0 -> 1368 bytes 7 files changed, 428 insertions(+) create mode 100644 Master/texmf/texconfig/README create mode 100644 Master/texmf/texconfig/g/generic create mode 100644 Master/texmf/texconfig/generic create mode 100755 Master/texmf/texconfig/tcfmgr create mode 100644 Master/texmf/texconfig/tcfmgr.map create mode 100644 Master/texmf/texconfig/v/vt100 create mode 100644 Master/texmf/texconfig/x/xterm diff --git a/Master/texmf/texconfig/README b/Master/texmf/texconfig/README new file mode 100644 index 00000000000..330771aa4fd --- /dev/null +++ b/Master/texmf/texconfig/README @@ -0,0 +1,23 @@ +Thomas Esser, 1999. Public domain. + +I hereby put this README file and the files g/generic, v/vt100 and +x/xterm into the public donain. + +The files contained in the subdirectories are provided, because +texconfig havily relies on a properly installed terminfo system. + +Some systems have buggy or touble-causing terminfo files and/or +a buggy curses library. Therefore, the dialog program provided +by me is linked against the ncurses library and uses its own +terminfo files. + +Set the variable + + DIALOG_TERMINFO to specify an alternate terminfo directory + (e.g. /usr/lib/terminfo) + + DIALOG_TERM to use an alternate configuration file (e.g. xterm) + +before starting texconfig. + +texconfig sets DIALOG_TERM to generic by default. diff --git a/Master/texmf/texconfig/g/generic b/Master/texmf/texconfig/g/generic new file mode 100644 index 00000000000..5165d2c1600 Binary files /dev/null and b/Master/texmf/texconfig/g/generic differ diff --git a/Master/texmf/texconfig/generic b/Master/texmf/texconfig/generic new file mode 100644 index 00000000000..1638aa827f5 --- /dev/null +++ b/Master/texmf/texconfig/generic @@ -0,0 +1,10 @@ +# +# Minimal terminfo configuration to run the dialog program. +# If this configuration causes problems, please let me know. +# +generic, + cols#80, lines#25, + clear=^[[H^[[2J, + kcud1=^[[B, kcub1=^[[D, kcuf1=^[[C, kcuu1=^[[A, + rev=^[[7m, smso=^[[7m, sgr0=^[[m, rmso=^[[m, bold=^[[1m, + cup=^[[%i%p1%d;%p2%dH, diff --git a/Master/texmf/texconfig/tcfmgr b/Master/texmf/texconfig/tcfmgr new file mode 100755 index 00000000000..fcbf45e520c --- /dev/null +++ b/Master/texmf/texconfig/tcfmgr @@ -0,0 +1,385 @@ +#!/bin/sh + +# invoke the right shell: + +test -f /bin/ksh && test -z "$RUNNING_KSH" \ + && { UNAMES=`uname -s`; test "x$UNAMES" = xULTRIX; } 2>/dev/null \ + && { RUNNING_KSH=true; export RUNNING_KSH; exec /bin/ksh $0 ${1+"$@"}; } +unset RUNNING_KSH + +test -f /bin/bsh && test -z "$RUNNING_BSH" \ + && { UNAMES=`uname -s`; test "x$UNAMES" = xAIX; } 2>/dev/null \ + && { RUNNING_BSH=true; export RUNNING_BSH; exec /bin/bsh $0 ${1+"$@"}; } +unset RUNNING_BSH + +export PATH + +# hack around a bug in zsh: +test -n "${ZSH_VERSION+set}" && alias -g '${1+"$@"}'='"$@"' + +progname=tcfmgr + +abort() +{ + echo "$progname: $@." >&2 + (exit 1); exit 1 +} + +mktexupd() +{ + setupMktexupd + $TFC_MKTEXUPD "$@" >&2 +} + +# call mktexdir script, disable all features (to prevent sticky directories) +mktexdir() +{ + setupMktexDir + MT_FEATURES=none $TFC_MKTEXDIR "$@" >&2 +} + +setupMap() +{ + case $setupMapOK in + "") : ;; + *) (exit 0); return 0;; + esac + + case $TFC_MAP in + "") TFC_MAP=`(kpsewhich -progname=texconfig -format='other text files' tcfmgr.map) 2>/dev/null`;; + esac + + case $TFC_MAP in + "") abort "config file \`tcfmgr.map' (usually in \$TEXMFMAIN/texconfig) not found";; + esac + + if test ! -f "$TFC_MAP"; then + abort "config file \`TFC_MAP' does not exist" + fi + setupMapOK=true +} + +setupTemp() +{ + case $setupTempOK in + "") : ;; + *) (exit 0); return 0;; + esac + + case $TFC_TEMP in + "") TFC_TEMP=${TEMPDIR-/tmp};; + esac + + if test ! -d "$TFC_TEMP"; then + abort "temp directory \`$TFC_TEMP' does not exist" + fi + + if test ! -w "$TFC_TEMP"; then + abort "temp directory \`$TFC_TEMP' is not writable" + fi + setupTempOK=true +} + +setupTexmfConfig() +{ + case $TFC_TEXMFCONFIG in + "") TFC_TEXMFCONFIG=`(kpsewhich -var-value=TEXMFCONFIG) 2>/dev/null`;; + *) (exit 0); return 0;; + esac + case $TFC_TEXMFCONFIG in + "") abort "variable \$TEXMFCONFIG is not defined in texmf.cnf";; + esac +} + +setupMktexDir() +{ + case $TFC_MKTEXDIR in + "") TFC_MKTEXDIR=`(kpsewhich --format='web2c files' mktexdir) 2>/dev/null`;; + esac + + case $TFC_MKTEXDIR in + "") abort "program mktexdir (usually in \$TEXMFMAIN/web2c) not found";; + esac +} + +setupMktexupd() +{ + case $TFC_MKTEXUPD in + "") TFC_MKTEXUPD=`(kpsewhich --format='web2c files' mktexupd) 2>/dev/null`;; + esac + + case $TFC_MKTEXUPD in + "") abort "program mktexupd (usually in \$TEXMFMAIN/web2c) not found";; + esac +} + +writableCheck() +{ + setupTexmfConfig + if test ! -d "$TFC_TEXMFCONFIG"; then + mktexdir "$TFC_TEXMFCONFIG" >/dev/null 2>&1 + if test ! -d "$TFC_TEXMFCONFIG"; then + msg="Directory TEXMFCONFIG=\`$TFC_TEXMFCONFIG' does not exist" + (exit 1); return 1 + fi + fi + + case "$relDir" in + "") get_info;; + esac + if test -f "$TFC_TEXMFCONFIG/$relDir/$TFC_FILE" \ + && test -w "$TFC_TEXMFCONFIG/$relDir/$TFC_FILE" + then + (exit 0); return 0 + fi + + if test -d "$TFC_TEXMFCONFIG/$relDir"; then + if test -w "$TFC_TEXMFCONFIG/$relDir"; then + (exit 0); return 0 + else + msg="Directory \`$TFC_TEXMFCONFIG/$relDir' is not writable" + (exit 1); return 1 + fi + else + # we assume that a "mkdir -p" would work if the top-level + # $TFC_TEXMFCONFIG is writable + if test -w "$TFC_TEXMFCONFIG"; then + (exit 0); return 0 + else + msg="Directory \`$TFC_TEXMFCONFIG' is not writable" + (exit 1); return 1 + fi + fi +} + +get_info() +{ + case "$TFC_FILE" in + "") abort "missing --file option or empty argument";; + esac + setupMap + # prepare + get info + IFS=$TAB + # set -- x `(awk '$1 == file' file=$TFC_FILE <$TFC_MAP) 2>/dev/null`; shift + set -- x `(grep "^$TFC_FILE[ ]" $TFC_MAP) 2>/dev/null`; shift + IFS=$STD_IFS + + # assign results + file="$1" + relDir="$2" + kpseFormat="$3" + kpseProgArg="$4" + + # sanity checks + case $file in + "") abort "no info for file \`$TFC_FILE' in map \`$TFC_MAP'";; + esac + + case $relDir in + -) abort "no known standard location for file \`$TFC_FILE' in map \`$TFC_MAP'";; + esac + + case $kpseProgArg in + -) kpseProgArg=kpsewhich;; + esac +} + +check_out() +{ + if $createEmptyFile; then + : + else + case "$orig" in + "") + get_info + orig=`(kpsewhich -format="$kpseFormat" -progname="$kpseProgArg" "$TFC_FILE") 2>/dev/null` + ;; + *) + test -f "$orig" || orig= + esac + + case $orig in + "") abort "file \`$TFC_FILE' not found";; + esac + fi + + # writableCheck needs to get a valid relDir, so it calls get_info if necessary + if writableCheck; then + : ok + else + cat >&2 < "$TFC_TEMP/$TFC_ID/in/$TFC_FILE" + > "$TFC_TEMP/$TFC_ID/out/$TFC_FILE") + else + cp "$orig" "$TFC_TEMP/$TFC_ID/in/$TFC_FILE" \ + || abort "copy \`$orig' -> \`$TFC_TEMP/$TFC_ID/in/$TFC_FILE' failed" + + cp "$orig" "$TFC_TEMP/$TFC_ID/out/$TFC_FILE" \ + || abort "copy \`$orig' -> \`$TFC_TEMP/$TFC_ID/out/$TFC_FILE' failed" + + chmod u+w "$TFC_TEMP/$TFC_ID/out/$TFC_FILE" + fi + + cat >"$TFC_TEMP/$TFC_ID/relDir" < "$TFC_TEMP/$TFC_ID/file" </dev/null`;; + esac + + for f in "$TFC_TEMP/$TFC_ID/relDir" "$TFC_TEMP/$TFC_ID/file" "$TFC_TEMP/$TFC_ID/in/$TFC_FILE" "$TFC_TEMP/$TFC_ID/out/$TFC_FILE"; do + if test ! -f "$f"; then + abort "Oops! file \`$f' does not exist" + fi + done + + if (cmp "$TFC_TEMP/$TFC_ID/in/$TFC_FILE" "$TFC_TEMP/$TFC_ID/out/$TFC_FILE") >/dev/null 2>&1; then + (exit 0); return 0 + fi + + setupTexmfConfig + relDir=`cat "$TFC_TEMP/$TFC_ID/relDir"` + if test ! -d "$TFC_TEXMFCONFIG/$relDir"; then + setupMktexDir + mktexdir "$TFC_TEXMFCONFIG/$relDir" || abort "could not create directory \`$TFC_TEXMFCONFIG/$relDir'" + fi + + if test -f "$TFC_TEXMFCONFIG/$relDir/$TFC_FILE"; then + needsLSRUpdate=false + test -w "$TFC_TEXMFCONFIG/$relDir/$TFC_FILE" || rm -f "$TFC_TEXMFCONFIG/$relDir/$TFC_FILE" + else + needsLSRUpdate=true + fi + + if test -f "$TFC_TEXMFCONFIG/$relDir/$TFC_FILE"; then + cat <"$TFC_TEMP/$TFC_ID/out/$TFC_FILE" >"$TFC_TEXMFCONFIG/$relDir/$TFC_FILE" || + abort "failed to write new file \`$TFC_TEXMFCONFIG/$relDir/$TFC_FILE'" + else + cp "$TFC_TEMP/$TFC_ID/out/$TFC_FILE" "$TFC_TEXMFCONFIG/$relDir/$TFC_FILE" || + abort "failed to copy \`$TFC_TEMP/$TFC_ID/out/$TFC_FILE' to \`$TFC_TEXMFCONFIG/$relDir/$TFC_FILE'" + chmod 644 "$TFC_TEXMFCONFIG/$relDir/$TFC_FILE" 2>/dev/null + fi + if $needsLSRUpdate; then + mktexupd "$TFC_TEXMFCONFIG/$relDir" "$TFC_FILE" + fi + echo "$TFC_TEXMFCONFIG/$relDir/$TFC_FILE" + (exit 0); return 0 +} + +find_file() +{ + get_info + kpsewhich -format="$kpseFormat" -progname="$kpseProgArg" "$TFC_FILE" +} + +help() +{ + cat <