On Mon, 27 Feb 2006, Danai SAE-HAN =?UTF-8?Q? ?= wrote: > I would like to see some additional checks in update-language. > More specifically, update-language should check whether the > language and hyphenation files exist, and should respond with > an error message if it can't find a file in the TEXMF tree.
Hi all! Please comment about the following code: It adds checks to this in the unified update- script: It would ONLY be called if update-XXXX is called with the --check option. # # perform_content_check # # This function *TRIES* to check wether the installed files are correct in # the sense that every file occurring in it is present. This can help to # find typing errors perform_content_check () { # # performing content checking only works when kpsewhich is present # and configured, this can be done in one step: if kpsewhich --version >/dev/null 2>&1 ; then if [ "$progname" = "update-language" ] ; then perform_content_check_language "$2" elif [ "$progname" = "update-updmap" ] ; then perform_content_check_map "$2" elif [ "$progname" = "update-fmtutil" ] ; then perform_content_check_format "$2" fi fi } perform_content_check_language () { fn="$1" cat "$fn" | grep -v '^\W*\(%\|=\|$\)' | while read lang hyph comm ; do # now check the existence of the hyphenation file if [ -z $(kpsewhich -format=tex $hyph) ] ; then cat >&2 <<EOF DEBUG: lang=$lang hyph=$hyph comm=$comm The config file $fn references a not-existing file $hyph This may be ok, but it could also be a typing error. EOF fi done } perform_content_check_map () { fn="$1" cat "$fn" | grep -i '^[ \t]*\(Mixed\)\?*Map' | while read foo map ; do # now check the existence of the hyphenation file if [ -z $(kpsewhich -format=map $map) ] ; then cat >&2 <<EOF The config file $fn references a not-existing file $map This may be ok, but it could also be a typing error. EOF fi done } perform_content_check_format () { fn="$1" cat "$fn" | grep -v '^\W*\(#\|$\)' | while read format engine hyphenation args ; do # this is stolen from fmtutil set - $args pool=; tcx= case $1 in nls=*) pool=$(echo $1 | sed '[EMAIL PROTECTED]@@; s@,.*@@') tcx=$(echo $1 | sed '[EMAIL PROTECTED],]*@@; [EMAIL PROTECTED],@@') shift ;; esac texargs="$@" eval lastarg=\$$# inifile=$(echo $lastarg | sed 's%^\*%%') case "$engine" in mpost) fmtfile="$format.mem"; kpsefmt=mpost;; mf|mfw|mf-nowin) fmtfile="$format.base"; kpsefmt=mf;; *) fmtfile="$format.fmt"; kpsefmt=tex;; esac # now check the existence of the hyphenation file if [ -z $(kpsewhich -progname=$format -format=$kpsefmt $inifile) ] ; then cat >&2 <<EOF The config file $fn references a not-existing file $inifile This may be ok, but it could also be a typing error. EOF fi done } Best wishes Norbert ------------------------------------------------------------------------------- Dr. Norbert Preining <preining AT logic DOT at> Università di Siena gpg DSA: 0x09C5B094 fp: 14DF 2E6C 0307 BE6D AD76 A9C0 D2BF 4AA3 09C5 B094 ------------------------------------------------------------------------------- SAVERNAKE (vb.) To sew municipal crests on to a windcheater in the belief that this will make the wearer appear cosmopolitan. --- Douglas Adams, The Meaning of Liff -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]