[Debian-tex-commits] SVN tex-common commit + diffs: r5054 - tex-common/branches/v3/scripts
Norbert Preining
preining at alioth.debian.org
Sun Feb 26 01:54:19 UTC 2012
Author: preining
Date: 2012-02-26 01:54:18 +0000 (Sun, 26 Feb 2012)
New Revision: 5054
Added:
tex-common/branches/v3/scripts/update-fmtlang
tex-common/branches/v3/scripts/update-fmtlang.1
tex-common/branches/v3/scripts/update-updmap
Removed:
tex-common/branches/v3/scripts/update-fontlang
tex-common/branches/v3/scripts/update-fontlang.1
Modified:
tex-common/branches/v3/scripts/dh_installtex
Log:
commit work on generating updmap per tree
Modified: tex-common/branches/v3/scripts/dh_installtex
===================================================================
--- tex-common/branches/v3/scripts/dh_installtex 2012-02-24 09:41:01 UTC (rev 5053)
+++ tex-common/branches/v3/scripts/dh_installtex 2012-02-26 01:54:18 UTC (rev 5054)
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
# dh_installtex --- register Type 1 fonts, languages, or formats with TeX
# Copyright (C) 2006, 2007 Florent Rougon
-# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Norbert Preining
+# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Norbert Preining
# Copyright (C) 2006, 2007 Frank Küster
#
# This program is free software; you can redistribute it and/or modify
@@ -157,13 +157,18 @@
=item B<--flavor=>I<flavor>[,I<flavor>]
-This option will be used to switch additional options on. The argument
+This option is used to select a different tree then the default
+/usr/share/texmf, and to switch on additional options. The argument
specify a list from flavors to be selected.
At the moment you can select from the following list of flavors:
+B<tree:texlive>,
B<map:config_for_active_maps>, B<map:config_for_all_maps>,
B<format:build_all>, B<format:add_one:I<formatname>>, and
B<lsr:full>.
+B<tree:texlive> will select the tree /usr/share/texlive/texmf-dist and
+should only be used for files installed into this tree.
+
B<map:config_for_active_maps> will create a file I<config.bar> for each active
(i.e. uncommented) map in each of the cfg file generated by one of the
three methods described above. These files are installed in
@@ -197,7 +202,8 @@
message, even if this option is not given.
B<lsr:full>: Recreate the lsr database not only for the standard trees,
-but also the distribution tree C</usr/share/texmf-texlive>.
+but also the distribution tree C</usr/share/texlive/texmf> and
+C</usr/share/texlive/texmf-dist>.
=back
@@ -229,6 +235,7 @@
my @addbuildformats = (); # additional formats to be build
my $priority=20; # priority with which files are installed
my $doformatlinks = 1;
+my $texmftree = "texmf";
my %cmdlineargs;
my %cmdlinefiles;
my %cmdlinefilespriority;
@@ -419,6 +426,8 @@
$doformatlinks = 0;
} elsif ($fl eq "lsr:full") {
$dofulllsr = 1;
+ } elsif ($fl eq "tree:texlive") {
+ $texmftree = "texlive";
} else {
error("Specified flavor $fl not supported.\nPlease see man page for supported flavors!\n");
}
@@ -483,8 +492,12 @@
error("This call would create multiple copies of $priority$package.$configfileext{$_}.\nPlease read the man page on how this should be fixed!\n");
}
- if ( ! $dh{ONLYSCRIPTS} && ! -d "$tmp/etc/texmf/$configdir{$type}/") {
- doit("install","-d","$tmp/etc/texmf/$configdir{$type}/");
+ my $targetdir = "$tmp/etc/texmf/$configdir{$type}";
+ if ($type eq "map") {
+ $targetdir = "$tmp/var/lib/tex-common/$managedir{$type}/$texmftree";
+ }
+ if ( ! $dh{ONLYSCRIPTS} && ! -d $targetdir) {
+ doit("install", "-d", $targetdir);
};
#
# the cmd line cfg files
@@ -492,14 +505,18 @@
foreach (@cmdlineconfigfiles) {
$bn=basename($_);
$pr=$cmdlinefilespriority{$type}{$_};
- $dofilen = "$tmp/etc/texmf/$configdir{$type}/$pr$bn";
+ if ($type eq "map") {
+ $dofilen = "$targetdir/$bn";
+ } else {
+ $dofilen = "$targetdir/$pr$bn";
+ }
WRITECMDLINECFGFILE: do {
-r $dofilen &&
error("The config file $dofilen already exists! Cannot recreate it, please call dh_clean -k!");
open(CFGFILE, ">$dofilen") ||
error("Cannot open $dofilen for writing!");
verbose_print("Writing $dofilen");
- if (!magic_comment_present($_)) {
+ if (($type ne "map") && !magic_comment_present($_)) {
print CFGFILE "$commentchar{$type} $pr$bn\n";
foreach $i (@magicheader) {
print CFGFILE "$commentchar{$type} $i\n";
@@ -521,15 +538,18 @@
# merge in the cmd line arguments
#
if ( ! $dh{ONLYSCRIPTS} && ( $pkgprovidedfile || ($#cmdlinearguments >= 0) )) {
- $dofilen = "$tmp/etc/texmf/$configdir{$type}/$priority$package.$configfileext{$type}";
+ my $basefile = "$priority$package.$configfileext{$type}";
+ $basefile = "$package.$configfileext{$type}" if ($type eq "map");
+ $dofilen = "$targetdir/$basefile";
-r $dofilen &&
error("The config file $dofilen already exists! Cannot recreate it, please call dh_clean -k!");
open(CFGFILE, ">$dofilen") ||
error("Cannot open $dofilen for writing!");
verbose_print("Writing $dofilen");
- if (($pkgprovidedfile && !magic_comment_present($pkgfilename)) ||
+ if (($pkgprovidedfile && ($type ne "map") &&
+ !magic_comment_present($pkgfilename)) ||
(!$pkgprovidedfile && ($#cmdlinearguments >= 0))) {
- print CFGFILE "$commentchar{$type} $priority$package.$configfileext{$type}\n";
+ print CFGFILE "$commentchar{$type} $basefile\n";
foreach (@magicheader) {
print CFGFILE "$commentchar{$type} $_\n";
}
@@ -562,7 +582,7 @@
@fmtconffiles = @listlines;
}
close(LISTFILE);
- } unless ($dh{ONLYSCRIPTS});
+ } unless (($type eq "map") || $dh{ONLYSCRIPTS});
}
my @mapdata = ();
@@ -643,7 +663,7 @@
# for trigger support
addsubstvar($package, "misc:Depends", "dpkg", ">= 1.14.18");
- addsubstvar($package, "misc:Depends", "tex-common", ">= 2.00");
+ addsubstvar($package, "misc:Depends", "tex-common", ">= 3");
}
=head1 SEE ALSO
@@ -663,4 +683,4 @@
### tab-width: 4
### indent-tabs-mode: t
### End:
-# vim:set tabstop=4 fileencoding=utf-8: #
+# vim:set tabstop=4 autoindent fileencoding=utf-8: #
Copied: tex-common/branches/v3/scripts/update-fmtlang (from rev 5053, tex-common/branches/v3/scripts/update-fontlang)
===================================================================
--- tex-common/branches/v3/scripts/update-fmtlang (rev 0)
+++ tex-common/branches/v3/scripts/update-fmtlang 2012-02-26 01:54:18 UTC (rev 5054)
@@ -0,0 +1,812 @@
+#!/bin/bash -e
+#
+# update-fmtlang --- Generate updmap.cfg, language.dat, fmtutil.cnf
+# from a set of files
+# Copyright (C) 2002 Atsuhito Kohda
+# Copyright (C) 2004, 2005, 2006, 2007 Florent Rougon
+# Copyright (C) 2005, 2006, 2009, 2010, 2011, 2012 Norbert Preining
+# Copyright (C) 2007 Frank Küster
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 dated June, 1991.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING. If not, write to the
+# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+
+version="1.0"
+progname=$(basename "$0")
+
+SYSPATH_BASE=/var/lib/texmf
+
+HYPHENMODE=nohyphen
+
+if [ "$progname" = "update-language" ] ; then
+ update-language-dat
+ update-language-def
+ exit 0
+elif [ "$progname" = "update-language-def" ] ; then
+ CNFDIR=hyphen.d
+ HYPHENMODE=etex
+ # System-wide configuration directory
+ SYSWIDE_CONFDIR=/etc/texmf/$CNFDIR
+ CHECKFILE="$SYSWIDE_CONFDIR/00tex.cnf"
+ EXT="cnf"
+ MEMORY_DIR=/var/lib/tex-common/hyphen-cnf
+ PATH_COMPONENT=tex/generic/config
+ SYSWIDE_VARD="$SYSPATH_BASE/$PATH_COMPONENT"
+ DEFAULT_OUTPUTFILE_BASENAME=language.def
+ SYSWIDE_DEFAULT_OUTPUTFILE="$SYSWIDE_VARD/$DEFAULT_OUTPUTFILE_BASENAME"
+ CC="%" # for COMMENTCHAR
+ # in printf, %% is one %
+ PCC="%%" # for printfCOMMENTCHAR
+ SHORT_DESC="Generate language.def, the hyphenation configuration file for eTeX and friends"
+elif [ "$progname" = "update-language-dat" ] ; then
+ CNFDIR=hyphen.d
+ HYPHENMODE=latex
+ # System-wide configuration directory
+ SYSWIDE_CONFDIR=/etc/texmf/$CNFDIR
+ CHECKFILE="$SYSWIDE_CONFDIR/00tex.cnf"
+ EXT="cnf"
+ MEMORY_DIR=/var/lib/tex-common/hyphen-cnf
+ PATH_COMPONENT=tex/generic/config
+ SYSWIDE_VARD="$SYSPATH_BASE/$PATH_COMPONENT"
+ DEFAULT_OUTPUTFILE_BASENAME=language.dat
+ SYSWIDE_DEFAULT_OUTPUTFILE="$SYSWIDE_VARD/$DEFAULT_OUTPUTFILE_BASENAME"
+ CC="%" # for COMMENTCHAR
+ # in printf, %% is one %
+ PCC="%%" # for printfCOMMENTCHAR
+ SHORT_DESC="Generate language.dat, the hyphenation configuration file for LaTeX"
+elif [ "$progname" = "update-updmap" ] ; then
+ echo "I should NOT be called this way, there is something wrong!!! ... good bye!" >&2
+ exit 1
+ CNFDIR=updmap.d
+ # System-wide configuration directory
+ SYSWIDE_CONFDIR=/etc/texmf/$CNFDIR
+ CHECKFILE="$SYSWIDE_CONFDIR/00updmap.cfg"
+ EXT="cfg"
+ MEMORY_DIR=/var/lib/tex-common/fontmap-cfg
+ PATH_COMPONENT=web2c
+ SYSWIDE_VARD="$SYSPATH_BASE/$PATH_COMPONENT"
+ DEFAULT_OUTPUTFILE_BASENAME=updmap.cfg
+ SYSWIDE_DEFAULT_OUTPUTFILE="$SYSWIDE_VARD/$DEFAULT_OUTPUTFILE_BASENAME"
+ CC="#"
+ PCC="#" # for printfCOMMENTCHAR
+ SHORT_DESC="Generate an updmap configuration file"
+elif [ "$progname" = "update-fmtutil" ] ; then
+ CNFDIR=fmt.d
+ # System-wide configuration directory
+ SYSWIDE_CONFDIR=/etc/texmf/$CNFDIR
+ CHECKFILE="$SYSWIDE_CONFDIR/00tex.cnf"
+ EXT="cnf"
+ MEMORY_DIR=/var/lib/tex-common/fmtutil-cnf
+ PATH_COMPONENT=web2c
+ SYSWIDE_VARD="$SYSPATH_BASE/$PATH_COMPONENT"
+ DEFAULT_OUTPUTFILE_BASENAME=fmtutil.cnf
+ SYSWIDE_DEFAULT_OUTPUTFILE="$SYSWIDE_VARD/$DEFAULT_OUTPUTFILE_BASENAME"
+ CC="#"
+ PCC="#" # for printfCOMMENTCHAR
+ SHORT_DESC="Generate an fmtutil configuration file"
+else
+ echo "Please call me either as update-updmap, update-language, or update-fmtutil!"
+ exit 1
+fi
+
+usage="Usage: $progname [OPTION...]
+${SHORT_DESC}.
+
+Options:
+ -c, --conf-dir=DIR directory where the user-specific configuration is
+ looked for in user-specific mode
+ -o, --output-file=FILE file to write the output to (default is
+ $SYSWIDE_DEFAULT_OUTPUTFILE in system-wide-mode,
+ and depends on your Kpathsea settings in
+ user-specific mode)
+ --checks perform sanity checks on the generated config file
+ --quiet don't write anything to the standard output during
+ normal operation
+ --help display this help message and exit
+ --version output version information and exit"
+
+
+DebPkgProvidedMaps_magic_comment="^[#%] -_- DebPkgProvidedMaps -_-"
+
+# This ensures that if $tempfile is in the *environment*, we won't erase
+# the file it could point to in case the script is killed by a signal before
+# it has had a chance to even create its temporary file.
+tempfile=""
+
+
+cleanup()
+{
+ rc=$?
+ [ -n "$tempfile" ] && rm -f "$tempfile"
+ exit $rc
+}
+
+do_one_hyphen_line()
+{
+ line="$1"
+ case "$line" in
+ ${CC}*) echo "$line" >> "$tempfile" ; return ;;
+ USEFILE*)
+ set -- $line
+ shift
+ datfile="$1"
+ deffile="$2"
+ if [ "$HYPHENMODE" = "etex" ] ; then
+ if [ -r "$deffile" ] ; then
+ cat "$deffile" >> "$tempfile"
+ else
+ echo "${CC} USEFILE $deffile not found" >> "$tempfile"
+ fi
+ else
+ if [ -r "$datfile" ] ; then
+ cat "$datfile" >> "$tempfile"
+ else
+ echo "${CC} USEFILE $datfile not found" >> "$tempfile"
+ fi
+ fi
+ return
+ ;;
+ esac
+ set -- $line
+ name=""
+ lhm=""
+ rhm=""
+ synonyms=""
+ f=""
+ while [ ! "$1" = "" ] ; do
+ case "$1" in
+ name=*) name="${1#name=}" ;;
+ lefthyphenmin=*) lhm="${1#lefthyphenmin=}" ;;
+ righthyphenmin=*) rhm="${1#righthyphenmin=}" ;;
+ synonyms=*) synonyms="${1#synonyms=}" ;;
+ file=*) f="${1#file=}" ;;
+ *) echo "Unknown AddHypen directive ==$line==!" >&2 ; return ;;
+ esac
+ shift
+ done
+ if [ "$name$lhm$rhm$synonyms$f" = "" ] ; then
+ return
+ fi
+ if [ ! "$lhm$rhm$synonyms$f" = "" ] ; then
+ if [ "$name" = "" ] ; then
+ echo "the line $line does not contain a name= directive, ignored!" >&2
+ return
+ fi
+ fi
+ if [ ! "$name$lhm$rhm$synonyms" = "" ] ; then
+ if [ "$f" = "" ] ; then
+ echo "the line $line does not contain a file= directive, ignored!" >&2
+ return
+ fi
+ fi
+ if [ "$HYPHENMODE" = "etex" ] ; then
+ printf '\\'"addlanguage{$name}{$f}{}{$lhm}{$rhm}" >> "$tempfile"
+ else
+ echo "$name $f" >> "$tempfile"
+ fi
+ if [ ! "$synonyms" = "" ] ; then
+ {
+ IFS=",$IFS"
+ for s in $synonyms ; do
+ if [ "$HYPHENMODE" = "etex" ] ; then
+ printf '\\'"addlanguage{$s}{$f}{}{$lhm}{$rhm}" >> "$tempfile"
+ else
+ echo "=$s" >> "$tempfile"
+ fi
+ done
+ }
+ fi
+}
+
+include_hyphen_file_core()
+{
+ file="$1"
+ cat "$1" | while read line ; do
+ do_one_hyphen_line "$line"
+ done
+}
+
+# include_file <file path>
+include_file()
+{
+ file="$1"
+
+ printf "\n${PCC}${PCC}${PCC} From file: $file\n" >>"$tempfile"
+ if [ $HYPHENMODE = "nohyphen" ] ; then
+ cat "$file" >>"$tempfile"
+ else
+ include_hyphen_file_core "$file"
+ fi
+ echo "${CC}${CC}${CC} End of file: $file" >>"$tempfile"
+ case "$file" in
+ */10texlive-latex-base.cnf)
+ seen_latex=1
+ ;;
+ esac
+}
+
+# do_not_include_file <file path>
+do_not_include_file()
+{
+ file="$1"
+
+ cat >>"$tempfile" <<EOF
+
+$CC$CC
+$CC$CC$CC $file not included because either it wasn't
+$CC$CC$CC up-to-date (conffile update pending) or the package shipping it was
+$CC$CC$CC apparently removed (no corresponding .list file in
+$CC$CC$CC $MEMORY_DIR/).
+$CC$CC
+EOF
+}
+
+# do_not_include_snippet_that_depends_on_a_not_included_snippet <file path>
+do_not_include_snippet_that_depends_on_a_not_included_snippet()
+{
+ file="$1"
+
+ cat >>"$tempfile" <<EOF
+
+$CC$CC
+$CC$CC$CC $file not included because it depends
+$CC$CC$CC on another file that is not included here. For instance, jadetex and
+$CC$CC$CC xmltex snippets are not included in fmtutil.cnf when the snippet for
+$CC$CC$CC LaTeX isn't included itself. This is because the jadetex and xmltex
+$CC$CC$CC formats need the LaTeX format when being built (see bug #427562).
+$CC$CC
+EOF
+}
+
+# swap_basename_and_dirname
+#
+# This function expects a file path on every line of stdin and will write
+# on stdout the same lines with the file basename and dirname swapped.
+# This is useful because we want to sort the files from several directories
+# based on their basenames only (the directory they are stored into mustn't
+# influence the order).
+swap_basename_and_dirname()
+{
+ # Use a slash as the separator between basename and dirname so that
+ # files or directories with e.g. spaces in their names are supported.
+ while read file; do
+ echo "$(basename "$file")$(dirname "$file")"
+ done
+}
+
+# check_special_jadetex_xmltex <file path>
+#
+# Special case for jadetex and xmltex: If no latex format information is
+# included so far ($seen_latex is still 0), then we cannot generate the jadetex
+# or xmltex formats, and may not include them in fmtutil.cnf. Even if both
+# packages depend on tl-latex-base, this is still needed, because if
+# tl-base-bin and tl-latex-base are upgraded at the same time, the latex
+# information is not included while tl-base-bin is configured and runs
+# "fmtutil --all" (see bug #427562).
+#
+# Return value:
+#
+# - 0 if:
+# * we are being called as update-fmtutil;
+# * and <file path> points to 40jadetex.cnf or 40xmltex.cnf;
+# * and $seen_latex=0.
+#
+# - 1 in all other cases.
+check_special_jadetex_xmltex()
+{
+ [ "$progname" = update-fmtutil ] || return 1
+
+ file="$1"
+
+ case "$file" in
+ */40jadetex.cnf|*/40xmltex.cnf)
+ if [ $seen_latex = 0 ]; then
+ return 0
+ fi
+ ;;
+ esac
+
+ return 1
+}
+
+# handle_file <file path>
+#
+# <file path> must point to an update-fontlang configuration file (such as
+# /etc/texmf/updmap.d/05tetex-extra.cfg). The function decides whether the file
+# should be included in $output_file and outputs the corresponding snippet if
+# yes, or a comment explaining why if no.
+handle_file()
+{
+ file="$1"
+
+ # Does the file have a dpkg-new sister?
+ if [ -f "${file}.dpkg-new" ]; then
+ do_not_include_file "$file"
+ else
+ # Does the file have the magic comment?
+ if grep -E "$DebPkgProvidedMaps_magic_comment" "$file" >/dev/null; then
+ # Is the package "$file" comes from still installed?
+ if [ -d "$MEMORY_DIR" ] \
+ && find "$MEMORY_DIR" -type f -name '*.list' -print0 \
+ | xargs -0r cat \
+ | grep -E "^$(basename "$file" ".$EXT")\$" >/dev/null;
+ then
+ if check_special_jadetex_xmltex "$file"; then
+ do_not_include_snippet_that_depends_on_a_not_included_snippet \
+ "$file"
+ else
+ include_file "$file"
+ fi
+ else
+ do_not_include_file "$file"
+ fi
+ else
+ include_file "$file"
+ fi
+ fi
+}
+
+# merge_files
+#
+# This function expects on the standard input a sorted list of update-updmap
+# configuration files (such as /etc/texmf/updmap.d/05tetex-extra.cfg). Each of
+# them should be listed on a line by itself with the basename being the
+# *first* component of the path, e.g.:
+#
+# 05tetex-extra.cfg/etc/texmf/updmap.d
+#
+# (where 05 should be at the beginning of the line, with no leading spaces, of
+# course). This is so because the sort operation presumably performed by the
+# caller of this function should sort on the basenames of the files,
+# regardless of the directories they come from.
+#
+# Since the list is expected to be sorted, if several files have the same
+# basename, they will be found on consecutive lines.
+#
+# The function calls handle_file() for every file in the list, but only once
+# for a single basename. If several files with the same basename are listed
+# from several directories, only the one in $conf_dir will be passed to
+# handle_file. This allows user-defined .cfg files to override system .cfg
+# files (those in /etc). The order of the files is preserved:
+# handle_file() will receive them as they came on stdin, except that it will
+# be called only once for each basename.
+#
+# handle_file receives the file path in the usual order (directory/basename).
+merge_files()
+{
+ # We will procede the list focusing on the last two elements in order to
+ # handle the case of several files in a row having the same basename.
+ lastfile=""
+ lastdir=""
+ # Overloaded files are files with the same basename that were found in
+ # several directories.
+ overloaded=0
+ # In case we are being called as update-fmtutil, seen_latex tells whether
+ # we have included the snippet for the LaTeX format so far. This is
+ # useful, because the snippets for formats that depend on LaTeX such
+ # jadetex and xmltex should only be included along with the snippet for
+ # the LaTeX format (see bug #427562).
+ seen_latex=0
+
+ while read line; do
+ filename="${line%%/*}"
+ dirname="/${line#*/}"
+ if [ -n "$lastfile" ]; then
+ if [ "$lastfile" != "$filename" ]; then
+ # For overloaded files, use the one in $conf_dir.
+ if [ $overloaded = 1 ]; then
+ overloaded=0
+ dir="$conf_dir"
+ else
+ dir="$lastdir"
+ fi
+ handle_file "$dir/$lastfile"
+ else
+ overloaded=1
+ fi
+ fi
+ lastdir="$dirname"
+ lastfile="$filename"
+ done
+
+ # Test whether there was at least one line to read from stdin
+ if [ -n "$lastdir" ]; then
+ # The last file is still in the pipe; get it out.
+ if [ $overloaded = 1 ]; then
+ dir="$conf_dir"
+ else
+ dir="$lastdir"
+ fi
+ handle_file "$dir/$lastfile"
+ fi
+}
+
+perform_sanity_checks()
+{
+ if [ -L "$output_file" ]; then
+ # This might cause errors, so do not skip this echo when quiet.
+ echo "$progname: $output_file is a symbolic link; won't do anything" >&2
+ exit 0
+ fi
+
+ if ! [ -r "$CHECKFILE" ] ; then
+ echo "$progname: cannot read $CHECKFILE" >&2
+ exit 1
+ fi
+
+ # Check for $DEFAULT_OUTPUTFILE_BASENAME in wrong places (currently,
+ # only enabled for update-updmap), if running in system-wide mode.
+ if [ $syswide_mode = 1 ] && [ "$progname" = "update-updmap" ]; then
+ badly_located_cfg_file="/etc/texmf/web2c/$DEFAULT_OUTPUTFILE_BASENAME"
+ badly_used_prg=updmap-sys
+ bad_options="--edit, --syncwithtrees, etc."
+
+ if [ -e "$badly_located_cfg_file" ]; then
+ printf "\
+Error: '$badly_located_cfg_file' should not exist when using the
+ Debian teTeX or TeX Live packages. Presumably, you used ${badly_used_prg}
+ in maintainance mode (options ${bad_options}).
+ This shouldn't be done with the Debian teTeX or TeX Live packages.
+ Instead, you should edit the files in ${SYSWIDE_CONFDIR}/ and run
+ ${progname}, mktexlsr and ${badly_used_prg}.
+ Please remove '$badly_located_cfg_file' and try again.\n" >&2
+ exit 1
+ fi
+ fi
+
+ # It could be that there is a DEFAULT_OUTPUTFILE_BASENAME file
+ # in TEXMFCONFIG, which would be found by kpathsea instead of the
+ # output_file. So we check for this and give a warning in case
+ # the created file would be shadowed.
+ if [ $syswide_mode = 0 ] && [ $output_file_specified = 0 ]; then
+ OLDIFS="$IFS"
+ IFS=:
+ for d in "$texmfconfig"; do
+ if [ ! "$d/$PATH_COMPONENT/$DEFAULT_OUTPUTFILE_BASENAME" \
+ = "$output_file" ] \
+ && [ -f "$d/$PATH_COMPONENT/$DEFAULT_OUTPUTFILE_BASENAME" ];
+ then
+ printf "\
+You are about to generate the file
+ $output_file
+but at the same time you have a file
+ $d/$PATH_COMPONENT/$DEFAULT_OUTPUTFILE_BASENAME
+which will shadow the former. We'll continue generating the first
+file, but to allow TeX and friends to find it, you'll have to remove the
+second one.\n"
+ # Don't break out as we want to warn the user for *every*
+ # shadowing file!
+ fi
+ done
+ IFS="$OLDIFS"
+ fi
+}
+
+# perform_contents_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_contents_check ()
+{
+ #
+ # performing contents 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_contents_check_language "$1"
+ elif [ "$progname" = "update-updmap" ] ; then
+ perform_contents_check_map "$1"
+ elif [ "$progname" = "update-fmtutil" ] ; then
+ perform_contents_check_format "$1"
+ fi
+ fi
+}
+
+perform_contents_check_language ()
+{
+ fn="$1"
+ grep -v '^\W*\(%\|=\|$\)' "$fn" | while read lang hyph comm ; do
+ # now check the existence of the hyphenation file
+ if [ -z $(kpsewhich -format=tex $hyph) ] ; then
+ cat >&2 <<EOF
+The config file $fn references a file not in the kpathsea database:
+ $hyph
+This may be ok, but it could also be a typing error.
+EOF
+ fi
+ done
+}
+
+perform_contents_check_map ()
+{
+ fn="$1"
+ grep -i '^\W*\(Mixed\)\?Map' "$fn" | 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 file not in the kpathsea database:
+ $map
+Calling updmap(-sys) will break!
+This may be ok, but it could also be a typing error.
+EOF
+ fi
+ done
+}
+
+perform_contents_check_format ()
+{
+ fn="$1"
+ grep -v '^\W*\(#\|$\)' "$fn" | while read format engine hyphenation args ; do
+ # this is stolen from fmtutil
+ set -- $args
+ pool=; tcx=
+ texargs="$@"
+ eval lastarg=\$$#
+ inifile=$(echo $lastarg | sed 's%^\*%%')
+ case "$engine" in
+ mpost) kpsefmt=mpost;;
+ mf|mfw|mf-nowin) kpsefmt=mf;;
+ *) 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 file not in the kpathsea database:
+ $inifile
+This may be ok, but it could also be a typing error.
+EOF
+ fi
+ done
+}
+
+
+# The list of signals to trap is taken from teTeX 3's updmap script, but they
+# have been converted to signal names because we can only rely on these on
+# POSIX systems.
+trap 'cleanup' HUP INT QUIT BUS PIPE TERM
+
+
+# -v (verbose) is here for backward compatibility only.
+TEMP=$(getopt -o +vc:o: --longoptions \
+ conf-dir:,output-file:,check,quiet,help,version \
+ -n "$progname" -- "$@")
+
+case $? in
+ 0) : ;;
+ 1) echo "$usage" >&2; exit 1 ;;
+ *) exit 1 ;;
+esac
+
+# Don't remove the quotes around $TEMP!
+eval set -- "$TEMP"
+
+# Determine whether we will run in system-wide mode or in user-specific mode
+if [ "$(id -u)" -eq 0 ]; then
+ syswide_mode=1
+else
+ syswide_mode=0
+fi
+
+
+# ****************************************************************************
+# * Defaults *
+# ****************************************************************************
+quiet=1
+dochecks=0
+output_file_specified=0
+
+if [ $syswide_mode = 1 ]; then
+ output_file="$SYSWIDE_DEFAULT_OUTPUTFILE"
+else
+ # If tetex-bin is not installed, kpsewhich is not available, and we cannot
+ # do anything
+ if ! which kpsewhich >/dev/null; then
+ echo "kpsewhich isn't available. Cannot create" \
+ "$DEFAULT_OUTPUTFILE_BASENAME in user-specific mode." >&2
+ exit 1
+ fi
+ # Is there an updmap.d/language.d directory somewhere in the expansion of
+ # $TEXMFCONFIG?
+ conf_dir=""
+ texmfconfig=$(kpsewhich --expand-path '$TEXMFCONFIG')
+ OLDIFS="$IFS"
+ IFS=:
+ for d in "$texmfconfig"; do
+ if [ -d "$d/$CNFDIR" ]; then
+ conf_dir="$d/$CNFDIR"
+ break
+ fi
+ done
+ IFS="$OLDIFS"
+
+ # Does $TEXMFVAR expand to a single directory?
+ texmfvar=$(kpsewhich --var-value 'TEXMFVAR')
+ if ! echo "$texmfvar" | grep -e '[,:]'; then
+ output_file="$texmfvar/$PATH_COMPONENT/$DEFAULT_OUTPUTFILE_BASENAME"
+ else
+ # We don't know what to do in this case, therefore: do nothing unless
+ # the output file is specified with the correponding option.
+ output_file=""
+ fi
+fi
+
+
+# ****************************************************************************
+# * Options handling *
+# ****************************************************************************
+while true; do
+ case "$1" in
+ -c|--conf-dir) conf_dir="$2"; shift 2 ;;
+ -o|--output-file)
+ output_file="$2"
+ output_file_specified=1
+ shift 2 ;;
+ --quiet) quiet=1; shift ;;
+ --check) dochecks=1; shift ;;
+ -v) printf "\
+${progname}'s -v option is deprecated. The default mode of operation will
+be verbose as soon as enough packages use the --quiet option. Please update
+your scripts accordingly.\n\n" >&2; quiet=0; shift ;;
+ --help) echo "$usage"; exit 0 ;;
+ --version) echo "$progname $version"; exit 0 ;;
+ --) shift; break ;;
+ *) echo "$progname: unexpected option '$1'; please report a bug." >&2
+ exit 1 ;;
+ esac
+done
+
+# Non-option arguments are not allowed.
+if [ $# -ne 0 ]; then
+ echo "$usage" >&2
+ exit 1
+fi
+
+# In user-specific mode, $conf_dir is required; let's check that.
+if [ $syswide_mode = 0 ]; then
+ if [ -z "$conf_dir" ]; then
+ printf "$progname: "
+ cat >&2 <<EOF
+unable to determine the configuration directory; you can
+specify it with --conf-dir
+EOF
+ exit 1
+ fi
+
+ # Make sure $conf_dir is an absolute path
+ if echo "$conf_dir" | grep -e '^[^/]' >/dev/null; then
+ conf_dir="${PWD}/${conf_dir}"
+ fi
+fi
+
+if [ -z "$output_file" ]; then
+ printf "$progname: "
+ cat >&2 <<EOF
+unable to determine where to write the output; you can specify
+that with --output-file
+EOF
+ exit 1
+fi
+
+perform_sanity_checks
+
+# Make sure the output directory exists (creating it if not) when running
+# in user-specific mode.
+if [ $syswide_mode = 0 ]; then
+ output_dir=$(dirname "$output_file")
+ if [ ! -d "$output_dir" ]; then
+ [ $quiet = 0 ] && printf "Creating directory '${output_dir}'... "
+ if ! mkdir -p "$output_dir"; then
+ echo "$progname: unable to create directory '$output_dir'" >&2
+ exit 1
+ fi
+ [ $quiet = 0 ] && echo "done."
+ fi
+fi
+
+# ****************************************************************************
+# * Actual work *
+# ****************************************************************************
+if [ $quiet = 0 ]; then
+ if [ -f "$output_file" ]; then
+ printf "Regenerating '${output_file}'... "
+ else
+ printf "Generating '${output_file}'... "
+ fi
+fi
+
+# Creating the temporary file in the output directory gives it automatically
+# the default permissions appropriate for that directory, according to the
+# user's umask. When it is complete, we'll be able to rename it atomically to
+# the desired output file, which will therefore have the right permissions.
+tempfile="${output_file}.new"
+
+confdirs="${SYSWIDE_CONFDIR}/"
+[ $syswide_mode = 0 ] && confdirs="${confdirs}\n# ${conf_dir}/"
+
+if ! printf "" > "$tempfile" ; then
+ echo "$progname: cannot write to the temporary file '$tempfile'" >&2
+ exit 1
+fi
+
+#
+# we have to make sure that language.def starts out the right way!
+if [ "$HYPHENMODE" = "etex" ] ; then
+ printf "\
+${PCC}${PCC} e-TeX V2.0;2
+
+${PCC} Note: the first line of this file must match the corresponding line
+${PCC} in \"etex.src\" and \"etexdefs.lib\", otherwise fallback will be used.
+\n" >> "$tempfile"
+fi
+
+printf "\
+${PCC}${PCC}${PCC} This file was automatically generated by ${progname}.
+${PCC}
+${PCC} Please do not edit it directly. If you want to add or change
+${PCC} anything here, please have a look at the files in:
+${PCC}
+${PCC} $confdirs
+${PCC}
+${PCC} and invoke ${progname}.
+${PCC}
+${PCC}${PCC}${PCC}\n" >> "$tempfile"
+
+# From now on, $tempfile must be deleted on exit; therefore, cleanup() should
+# be used.
+
+if [ $syswide_mode = 1 ]; then
+ find "$SYSWIDE_CONFDIR" -maxdepth 1 -type f -name '*.'${EXT}
+else
+ find "$SYSWIDE_CONFDIR" "$conf_dir" -maxdepth 1 -type f -name '*.'${EXT}
+fi | swap_basename_and_dirname | LC_COLLATE=C sort | merge_files
+
+#
+# for language.def we have to select the right language at the end
+if [ "$HYPHENMODE" = "etex" ] ; then
+ printf "
+${PCC}${PCC}${PCC} No changes may be made beyond this point.
+
+\\\\uselanguage {USenglish} ${PCC}${PCC}${PCC} This MUST be the last line of the file.
+" >> "$tempfile"
+fi
+
+# This is atomic.
+mv "$tempfile" "$output_file"
+
+# Check wether the generated file is decent, if all necessary files are
+# installed, etc.
+if [ "$dochecks" = 1 ] ; then
+ perform_contents_check "$output_file"
+fi
+
+if [ $quiet = 0 ]; then
+ printf "done.\n\n"
+ echo "$progname has updated '$output_file'. If you want to"
+
+ if [ "$progname" = "update-language" ]; then
+ echo "enable the new patterns, you should run fmtutil-sys or fmtutil"
+ echo "(with option --all, or with a particular format specified)."
+ elif [ "$progname" = "update-updmap" ]; then
+ echo "enable the map files with this new file, you should run" \
+ "updmap-sys or updmap."
+ elif [ "$progname" = "update-fmtutil" ]; then
+ echo "enable the new formats, you should run fmtutil-sys or fmtutil"
+ echo "(with option --all or --missing)."
+ else
+ echo "Unexpected \$progname: '$progname'" >&2
+ exit 1
+ fi
+fi
+
+# vim:set expandtab tabstop=4: #
Copied: tex-common/branches/v3/scripts/update-fmtlang.1 (from rev 5053, tex-common/branches/v3/scripts/update-fontlang.1)
===================================================================
--- tex-common/branches/v3/scripts/update-fmtlang.1 (rev 0)
+++ tex-common/branches/v3/scripts/update-fmtlang.1 2012-02-26 01:54:18 UTC (rev 5054)
@@ -0,0 +1,198 @@
+.TH update-fontlang 1 "2006-12-11" "Debian" "Debian User's Manual"
+
+.SH NAME
+update-updmap, update-language, update-fmtutil, update-fontlang \- update
+various TeX-related configuration files
+
+.SH SYNOPSIS
+.B update-updmap
+.RI [ options ]
+.br
+.B update-language
+.RI [ options ]
+.br
+.B update-fmtutil
+.RI [ options ]
+.br
+
+.SH DESCRIPTION
+This manual page explains briefly the usage of the three TeX configuration
+update programs
+.B update-updmap, update-language
+and \fBupdate-fmtutil\fP.
+.PP
+The
+.B update-fontlang
+script should not be called directly, but only via the three described links.
+For a more in-depth description, please see the document \fITeX on Debian\fP in
+.I /usr/share/doc/tex-common/TeX-on-Debian.txt.gz
+(also available as HTML and PDF).
+
+The programs \fBupdate-updmap\fP, \fBupdate-language\fP and
+\fBupdate-fmtutil\fP create or update the configuration files
+\fIupdmap.cfg\fP, \fIlanguage.dat\fP and \fIfmtutil.cnf\fP, respectively.
+These files define the the outline fonts available for the TeX system
+(\fIupdmap.cfg\fP), the hyphenation patterns to be loaded into LaTeX-related
+TeX formats (\fIlanguage.dat\fP), and the list of formats to be created
+(\fIfmtutil.cnf\fP).
+
+These programs can be used either in system-wide mode if called by root, or
+in a user-specific mode if called by a user without super-user privileges.
+.SH OPTIONS
+.TP
+.BI \-c\ DIR ,\ \-\-conf-dir= DIR
+directory where the user-specific configuration files are looked for in
+user-specific mode (default: \fITEXMFCONFIG/updmap.d\fP for
+\fBupdate-updmap\fP, \fITEXMFCONFIG/language.d\fP for \fBupdate-language\fP
+and \fITEXMFCONFIG/fmt.d\fP for \fBupdate-fmtutil\fP, where \fITEXMFCONFIG\fP
+is usually \fI$HOME/.texmf-config\fP).
+.TP
+.BI \-o\ FILE ,\ \-\-output-file= FILE
+file to write the output to. Per default, in system-wide mode,
+\fBupdate-updmap\fP writes to
+\fI/var/lib/texmf/web2c/updmap.cfg\fP,
+\fBupdate-language\fP writes to
+\fI/var/lib/texmf/tex/generic/config/language.dat\fP
+and
+\fBupdate-fmtutil\fP writes to
+\fI/var/lib/texmf/web2c/fmtutil.cnf\fP.
+.TP
+.B \-\-checks
+perform sanity checks on the generated config file. Don't use this
+in maintainer scripts.
+.TP
+.B \-\-quiet
+don't write anything to the standard output during normal operation
+.TP
+.B \-\-help
+print a summary of the command-line usage and exit
+.TP
+.B \-\-version
+output version information and exit
+
+.SH USAGE
+
+In system-wide mode, all three programs merge those files
+("configuration snippets") with a specific extension in the respective
+configuration directories to produce the final file. These
+configuration directories and extensions are \fIlanguage.d\fP and
+\fB.cnf\fP for \fBupdate-language\fP, \fIupdmap.d\fP and \fB.cfg\fP for
+\fBupdate-updmap\fP, and \fIfmt.d\fP and \fB.cnf\fP for \fBupdate-fmtutil\fP.
+In system-wide mode, these directories are those under \fI/etc/texmf/\fP. Both
+TeX add-on packages and local administrators can add files to these
+directories.
+
+If a package that provides such snippets is removed but not purged,
+including the snippet will likely break the system. To prevent the
+inclusion in these cases, snippets installed by \fIpackages\fP have to
+contain a magic header:
+
+# -_- DebPkgProvidedMaps -_-
+
+which local administrators should \fInot\fP remove. From the files
+with a magic header, only those files which are also listed in one of
+the files in
+.I /var/lib/tex-common/fontmap-cfg/
+for \fBupdate-updmap\fP,
+.I /var/lib/tex-common/language-cnf/
+for \fBupdate-language\fP, and
+.I /var/lib/tex-common/fmtutil-cnf/
+for \fBupdate-fmtutil\fP, are actually included into the final output
+file. This way, local changes to the configuration can be preserved
+while the package is in state 'rc' (that is, the package is removed, but its
+configuration files are still present). For details about this mechanism,
+package maintainers should consult the Debian TeX Policy. As a
+special case, the files for JadeTeX and xmlTeX are only included if
+there is already a file for the LaTeX format (see \fITeX on Debian\fP
+for details).
+
+The user-specific mode provides a way for a non-admin user to override
+system-wide settings. In this mode,
+\fBupdate-language\fP writes to
+\fITEXMFVAR/tex/generic/config/language.dat\fP,
+\fBupdate-updmap\fP writes to
+\fITEXMFVAR/web2c/updmap.cfg\fP, and
+\fBupdate-fmtutil\fP writes to
+\fITEXMFVAR/web2c/fmtutil.cnf\fP, where \fITEXMFVAR\fP is usually
+\fI$HOME/.texmf-var\fP.
+Furthermore, files present within the user-specific configuration
+directories are included \fIin addition\fP to the files present in the
+system-wide configuration directories. In case the same filename
+exists in the system-wide configuration directory and the
+user-specific configuration directory, the user-specific file is used
+instead of the system-wide one. The user-specific configuration directories
+are
+\fITEXMFCONFIG/updmap.d\fP for \fBupdate-updmap\fP,
+\fITEXMFCONFIG/language.d\fP for \fBupdate-language\fP and
+\fITEXMFCONFIG/fmt.d\fP
+for \fBupdate-fmtutil\fP, where \fITEXMFCONFIG\fP is usually
+\fI$HOME/.texmf-config\fP. The system-wide configuration directories have the
+same names, but are located in \fI/etc/texmf/\fP instead of \fITEXMFCONFIG\fP.
+
+Note that changes introduced by updates of packages are \fInot\fP
+propagated to the user's configuration files. This has to be done by hand.
+
+.SH FILES
+.TP
+.B /var/lib/texmf/tex/generic/config/language.dat
+This file is generated or updated by \fBupdate-language\fP in system-wide
+mode and contains a list of the hyphenation patterns loaded into
+LaTeX-based formats by \fBfmtutil-sys\fP.
+.TP
+.B /var/lib/texmf/web2c/updmap.cfg
+This file is generated or updated by \fBupdate-updmap\fP in system-wide
+mode and contains a list of map files to be included
+into the lists of outline fonts generated by \fBupdmap-sys\fP.
+.TP
+.B /var/lib/texmf/web2c/fmtutil.cnf
+This file is generated or updated by \fBupdate-fmtutil\fP in system-wide
+mode and contains a list of formats to be generated by \fBfmtutil-sys\fP.
+.TP
+.B /etc/texmf/language.d/\fIname\fP.cnf
+Input files for \fBupdate-language\fP
+.TP
+.B /etc/texmf/updmap.d/\fIname\fP.cfg
+Input files for \fBupdate-updmap\fP
+.TP
+.B /etc/texmf/fmt.d/\fIname\fP.cnf
+Input files for \fBupdate-fmtutil\fP
+.TP
+.B /var/lib/tex-common/language-cnf/\fIpackage\fP.list
+Lists the file(s) installed by \fIpackage\fP in \fI/etc/texmf/language.d/\fP.
+.TP
+.B /var/lib/tex-common/fontmap-cfg/\fIpackage\fP.list
+Lists the file(s) installed by \fIpackage\fP in \fI/etc/texmf/updmap.d/\fP.
+.TP
+.B /var/lib/tex-common/fmtutil-cnf/\fIpackage\fP.list
+Lists the file(s) installed by \fIpackage\fP in \fI/etc/texmf/fmt.d/\fP.
+
+.SH SEE ALSO
+
+.TP
+.B updmap(1), updmap-sys(1), fmtutil(1), fmtutil-sys(1)
+The programs actually using the generated configuration files
+(\fIupdmap.cfg\fP, \fIlanguage.dat\fP and \fIfmtutil.cnf\fP).
+.TP
+.B TeX on Debian Documentation
+to be found in \fI/usr/share/doc/tex-common/TeX-on-Debian.txt.gz\fP (also
+available as HTML and PDF), describing in more detail how to setup
+and maintain a TeX system in Debian. It also includes details on user-specific
+configuration.
+.TP
+.B Debian TeX Policy
+to be found in \fI/usr/share/doc/tex-common/Debian-TeX-Policy.txt.gz\fP (also
+available as HTML and PDF), describing the internals and the TeX Policy
+established on the Debian TeX mailing-list
+(debian-tex-maint at lists.debian.org). Intended audience is mainly developers
+packaging TeX-related resources for Debian.
+.TP
+.B dh_installtex(1)
+a debhelper-like script for managing the installation of files into the
+system-wide configuration directories; this script helps to write Debian
+packages containing TeX-related resources that conform to the Debian TeX
+Policy.
+
+.SH AUTHOR
+This manual page was written by Norbert Preining <preining at debian.org>
+for the Debian distribution (and may be used by others). It was later updated
+by Florent Rougon <f.rougon at free.fr>.
Deleted: tex-common/branches/v3/scripts/update-fontlang
===================================================================
--- tex-common/branches/v3/scripts/update-fontlang 2012-02-24 09:41:01 UTC (rev 5053)
+++ tex-common/branches/v3/scripts/update-fontlang 2012-02-26 01:54:18 UTC (rev 5054)
@@ -1,812 +0,0 @@
-#!/bin/bash -e
-#
-# update-fontlang --- Generate updmap.cfg, language.dat, fmtutil.cnf
-# from a set of files
-# Copyright (C) 2002 Atsuhito Kohda
-# Copyright (C) 2004, 2005, 2006, 2007 Florent Rougon
-# Copyright (C) 2005, 2006, 2009, 2010, 2011, 2012 Norbert Preining
-# Copyright (C) 2007 Frank Küster
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 dated June, 1991.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; see the file COPYING. If not, write to the
-# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
-# Boston, MA 02110-1301 USA.
-
-version="1.0"
-progname=$(basename "$0")
-
-SYSPATH_BASE=/var/lib/texmf
-
-HYPHENMODE=nohyphen
-
-if [ "$progname" = "update-language" ] ; then
- update-language-dat
- update-language-def
- exit 0
-elif [ "$progname" = "update-language-def" ] ; then
- CNFDIR=hyphen.d
- HYPHENMODE=etex
- # System-wide configuration directory
- SYSWIDE_CONFDIR=/etc/texmf/$CNFDIR
- CHECKFILE="$SYSWIDE_CONFDIR/00tex.cnf"
- EXT="cnf"
- MEMORY_DIR=/var/lib/tex-common/hyphen-cnf
- PATH_COMPONENT=tex/generic/config
- SYSWIDE_VARD="$SYSPATH_BASE/$PATH_COMPONENT"
- DEFAULT_OUTPUTFILE_BASENAME=language.def
- SYSWIDE_DEFAULT_OUTPUTFILE="$SYSWIDE_VARD/$DEFAULT_OUTPUTFILE_BASENAME"
- CC="%" # for COMMENTCHAR
- # in printf, %% is one %
- PCC="%%" # for printfCOMMENTCHAR
- SHORT_DESC="Generate language.def, the hyphenation configuration file for eTeX and friends"
-elif [ "$progname" = "update-language-dat" ] ; then
- CNFDIR=hyphen.d
- HYPHENMODE=latex
- # System-wide configuration directory
- SYSWIDE_CONFDIR=/etc/texmf/$CNFDIR
- CHECKFILE="$SYSWIDE_CONFDIR/00tex.cnf"
- EXT="cnf"
- MEMORY_DIR=/var/lib/tex-common/hyphen-cnf
- PATH_COMPONENT=tex/generic/config
- SYSWIDE_VARD="$SYSPATH_BASE/$PATH_COMPONENT"
- DEFAULT_OUTPUTFILE_BASENAME=language.dat
- SYSWIDE_DEFAULT_OUTPUTFILE="$SYSWIDE_VARD/$DEFAULT_OUTPUTFILE_BASENAME"
- CC="%" # for COMMENTCHAR
- # in printf, %% is one %
- PCC="%%" # for printfCOMMENTCHAR
- SHORT_DESC="Generate language.dat, the hyphenation configuration file for LaTeX"
-elif [ "$progname" = "update-updmap" ] ; then
- echo "update-updmap is not existing anymore ... good bye!" >&2
- exit 1
- CNFDIR=updmap.d
- # System-wide configuration directory
- SYSWIDE_CONFDIR=/etc/texmf/$CNFDIR
- CHECKFILE="$SYSWIDE_CONFDIR/00updmap.cfg"
- EXT="cfg"
- MEMORY_DIR=/var/lib/tex-common/fontmap-cfg
- PATH_COMPONENT=web2c
- SYSWIDE_VARD="$SYSPATH_BASE/$PATH_COMPONENT"
- DEFAULT_OUTPUTFILE_BASENAME=updmap.cfg
- SYSWIDE_DEFAULT_OUTPUTFILE="$SYSWIDE_VARD/$DEFAULT_OUTPUTFILE_BASENAME"
- CC="#"
- PCC="#" # for printfCOMMENTCHAR
- SHORT_DESC="Generate an updmap configuration file"
-elif [ "$progname" = "update-fmtutil" ] ; then
- CNFDIR=fmt.d
- # System-wide configuration directory
- SYSWIDE_CONFDIR=/etc/texmf/$CNFDIR
- CHECKFILE="$SYSWIDE_CONFDIR/00tex.cnf"
- EXT="cnf"
- MEMORY_DIR=/var/lib/tex-common/fmtutil-cnf
- PATH_COMPONENT=web2c
- SYSWIDE_VARD="$SYSPATH_BASE/$PATH_COMPONENT"
- DEFAULT_OUTPUTFILE_BASENAME=fmtutil.cnf
- SYSWIDE_DEFAULT_OUTPUTFILE="$SYSWIDE_VARD/$DEFAULT_OUTPUTFILE_BASENAME"
- CC="#"
- PCC="#" # for printfCOMMENTCHAR
- SHORT_DESC="Generate an fmtutil configuration file"
-else
- echo "Please call me either as update-updmap, update-language, or update-fmtutil!"
- exit 1
-fi
-
-usage="Usage: $progname [OPTION...]
-${SHORT_DESC}.
-
-Options:
- -c, --conf-dir=DIR directory where the user-specific configuration is
- looked for in user-specific mode
- -o, --output-file=FILE file to write the output to (default is
- $SYSWIDE_DEFAULT_OUTPUTFILE in system-wide-mode,
- and depends on your Kpathsea settings in
- user-specific mode)
- --checks perform sanity checks on the generated config file
- --quiet don't write anything to the standard output during
- normal operation
- --help display this help message and exit
- --version output version information and exit"
-
-
-DebPkgProvidedMaps_magic_comment="^[#%] -_- DebPkgProvidedMaps -_-"
-
-# This ensures that if $tempfile is in the *environment*, we won't erase
-# the file it could point to in case the script is killed by a signal before
-# it has had a chance to even create its temporary file.
-tempfile=""
-
-
-cleanup()
-{
- rc=$?
- [ -n "$tempfile" ] && rm -f "$tempfile"
- exit $rc
-}
-
-do_one_hyphen_line()
-{
- line="$1"
- case "$line" in
- ${CC}*) echo "$line" >> "$tempfile" ; return ;;
- USEFILE*)
- set -- $line
- shift
- datfile="$1"
- deffile="$2"
- if [ "$HYPHENMODE" = "etex" ] ; then
- if [ -r "$deffile" ] ; then
- cat "$deffile" >> "$tempfile"
- else
- echo "${CC} USEFILE $deffile not found" >> "$tempfile"
- fi
- else
- if [ -r "$datfile" ] ; then
- cat "$datfile" >> "$tempfile"
- else
- echo "${CC} USEFILE $datfile not found" >> "$tempfile"
- fi
- fi
- return
- ;;
- esac
- set -- $line
- name=""
- lhm=""
- rhm=""
- synonyms=""
- f=""
- while [ ! "$1" = "" ] ; do
- case "$1" in
- name=*) name="${1#name=}" ;;
- lefthyphenmin=*) lhm="${1#lefthyphenmin=}" ;;
- righthyphenmin=*) rhm="${1#righthyphenmin=}" ;;
- synonyms=*) synonyms="${1#synonyms=}" ;;
- file=*) f="${1#file=}" ;;
- *) echo "Unknown AddHypen directive ==$line==!" >&2 ; return ;;
- esac
- shift
- done
- if [ "$name$lhm$rhm$synonyms$f" = "" ] ; then
- return
- fi
- if [ ! "$lhm$rhm$synonyms$f" = "" ] ; then
- if [ "$name" = "" ] ; then
- echo "the line $line does not contain a name= directive, ignored!" >&2
- return
- fi
- fi
- if [ ! "$name$lhm$rhm$synonyms" = "" ] ; then
- if [ "$f" = "" ] ; then
- echo "the line $line does not contain a file= directive, ignored!" >&2
- return
- fi
- fi
- if [ "$HYPHENMODE" = "etex" ] ; then
- printf '\\'"addlanguage{$name}{$f}{}{$lhm}{$rhm}" >> "$tempfile"
- else
- echo "$name $f" >> "$tempfile"
- fi
- if [ ! "$synonyms" = "" ] ; then
- {
- IFS=",$IFS"
- for s in $synonyms ; do
- if [ "$HYPHENMODE" = "etex" ] ; then
- printf '\\'"addlanguage{$s}{$f}{}{$lhm}{$rhm}" >> "$tempfile"
- else
- echo "=$s" >> "$tempfile"
- fi
- done
- }
- fi
-}
-
-include_hyphen_file_core()
-{
- file="$1"
- cat "$1" | while read line ; do
- do_one_hyphen_line "$line"
- done
-}
-
-# include_file <file path>
-include_file()
-{
- file="$1"
-
- printf "\n${PCC}${PCC}${PCC} From file: $file\n" >>"$tempfile"
- if [ $HYPHENMODE = "nohyphen" ] ; then
- cat "$file" >>"$tempfile"
- else
- include_hyphen_file_core "$file"
- fi
- echo "${CC}${CC}${CC} End of file: $file" >>"$tempfile"
- case "$file" in
- */10texlive-latex-base.cnf)
- seen_latex=1
- ;;
- esac
-}
-
-# do_not_include_file <file path>
-do_not_include_file()
-{
- file="$1"
-
- cat >>"$tempfile" <<EOF
-
-$CC$CC
-$CC$CC$CC $file not included because either it wasn't
-$CC$CC$CC up-to-date (conffile update pending) or the package shipping it was
-$CC$CC$CC apparently removed (no corresponding .list file in
-$CC$CC$CC $MEMORY_DIR/).
-$CC$CC
-EOF
-}
-
-# do_not_include_snippet_that_depends_on_a_not_included_snippet <file path>
-do_not_include_snippet_that_depends_on_a_not_included_snippet()
-{
- file="$1"
-
- cat >>"$tempfile" <<EOF
-
-$CC$CC
-$CC$CC$CC $file not included because it depends
-$CC$CC$CC on another file that is not included here. For instance, jadetex and
-$CC$CC$CC xmltex snippets are not included in fmtutil.cnf when the snippet for
-$CC$CC$CC LaTeX isn't included itself. This is because the jadetex and xmltex
-$CC$CC$CC formats need the LaTeX format when being built (see bug #427562).
-$CC$CC
-EOF
-}
-
-# swap_basename_and_dirname
-#
-# This function expects a file path on every line of stdin and will write
-# on stdout the same lines with the file basename and dirname swapped.
-# This is useful because we want to sort the files from several directories
-# based on their basenames only (the directory they are stored into mustn't
-# influence the order).
-swap_basename_and_dirname()
-{
- # Use a slash as the separator between basename and dirname so that
- # files or directories with e.g. spaces in their names are supported.
- while read file; do
- echo "$(basename "$file")$(dirname "$file")"
- done
-}
-
-# check_special_jadetex_xmltex <file path>
-#
-# Special case for jadetex and xmltex: If no latex format information is
-# included so far ($seen_latex is still 0), then we cannot generate the jadetex
-# or xmltex formats, and may not include them in fmtutil.cnf. Even if both
-# packages depend on tl-latex-base, this is still needed, because if
-# tl-base-bin and tl-latex-base are upgraded at the same time, the latex
-# information is not included while tl-base-bin is configured and runs
-# "fmtutil --all" (see bug #427562).
-#
-# Return value:
-#
-# - 0 if:
-# * we are being called as update-fmtutil;
-# * and <file path> points to 40jadetex.cnf or 40xmltex.cnf;
-# * and $seen_latex=0.
-#
-# - 1 in all other cases.
-check_special_jadetex_xmltex()
-{
- [ "$progname" = update-fmtutil ] || return 1
-
- file="$1"
-
- case "$file" in
- */40jadetex.cnf|*/40xmltex.cnf)
- if [ $seen_latex = 0 ]; then
- return 0
- fi
- ;;
- esac
-
- return 1
-}
-
-# handle_file <file path>
-#
-# <file path> must point to an update-fontlang configuration file (such as
-# /etc/texmf/updmap.d/05tetex-extra.cfg). The function decides whether the file
-# should be included in $output_file and outputs the corresponding snippet if
-# yes, or a comment explaining why if no.
-handle_file()
-{
- file="$1"
-
- # Does the file have a dpkg-new sister?
- if [ -f "${file}.dpkg-new" ]; then
- do_not_include_file "$file"
- else
- # Does the file have the magic comment?
- if grep -E "$DebPkgProvidedMaps_magic_comment" "$file" >/dev/null; then
- # Is the package "$file" comes from still installed?
- if [ -d "$MEMORY_DIR" ] \
- && find "$MEMORY_DIR" -type f -name '*.list' -print0 \
- | xargs -0r cat \
- | grep -E "^$(basename "$file" ".$EXT")\$" >/dev/null;
- then
- if check_special_jadetex_xmltex "$file"; then
- do_not_include_snippet_that_depends_on_a_not_included_snippet \
- "$file"
- else
- include_file "$file"
- fi
- else
- do_not_include_file "$file"
- fi
- else
- include_file "$file"
- fi
- fi
-}
-
-# merge_files
-#
-# This function expects on the standard input a sorted list of update-updmap
-# configuration files (such as /etc/texmf/updmap.d/05tetex-extra.cfg). Each of
-# them should be listed on a line by itself with the basename being the
-# *first* component of the path, e.g.:
-#
-# 05tetex-extra.cfg/etc/texmf/updmap.d
-#
-# (where 05 should be at the beginning of the line, with no leading spaces, of
-# course). This is so because the sort operation presumably performed by the
-# caller of this function should sort on the basenames of the files,
-# regardless of the directories they come from.
-#
-# Since the list is expected to be sorted, if several files have the same
-# basename, they will be found on consecutive lines.
-#
-# The function calls handle_file() for every file in the list, but only once
-# for a single basename. If several files with the same basename are listed
-# from several directories, only the one in $conf_dir will be passed to
-# handle_file. This allows user-defined .cfg files to override system .cfg
-# files (those in /etc). The order of the files is preserved:
-# handle_file() will receive them as they came on stdin, except that it will
-# be called only once for each basename.
-#
-# handle_file receives the file path in the usual order (directory/basename).
-merge_files()
-{
- # We will procede the list focusing on the last two elements in order to
- # handle the case of several files in a row having the same basename.
- lastfile=""
- lastdir=""
- # Overloaded files are files with the same basename that were found in
- # several directories.
- overloaded=0
- # In case we are being called as update-fmtutil, seen_latex tells whether
- # we have included the snippet for the LaTeX format so far. This is
- # useful, because the snippets for formats that depend on LaTeX such
- # jadetex and xmltex should only be included along with the snippet for
- # the LaTeX format (see bug #427562).
- seen_latex=0
-
- while read line; do
- filename="${line%%/*}"
- dirname="/${line#*/}"
- if [ -n "$lastfile" ]; then
- if [ "$lastfile" != "$filename" ]; then
- # For overloaded files, use the one in $conf_dir.
- if [ $overloaded = 1 ]; then
- overloaded=0
- dir="$conf_dir"
- else
- dir="$lastdir"
- fi
- handle_file "$dir/$lastfile"
- else
- overloaded=1
- fi
- fi
- lastdir="$dirname"
- lastfile="$filename"
- done
-
- # Test whether there was at least one line to read from stdin
- if [ -n "$lastdir" ]; then
- # The last file is still in the pipe; get it out.
- if [ $overloaded = 1 ]; then
- dir="$conf_dir"
- else
- dir="$lastdir"
- fi
- handle_file "$dir/$lastfile"
- fi
-}
-
-perform_sanity_checks()
-{
- if [ -L "$output_file" ]; then
- # This might cause errors, so do not skip this echo when quiet.
- echo "$progname: $output_file is a symbolic link; won't do anything" >&2
- exit 0
- fi
-
- if ! [ -r "$CHECKFILE" ] ; then
- echo "$progname: cannot read $CHECKFILE" >&2
- exit 1
- fi
-
- # Check for $DEFAULT_OUTPUTFILE_BASENAME in wrong places (currently,
- # only enabled for update-updmap), if running in system-wide mode.
- if [ $syswide_mode = 1 ] && [ "$progname" = "update-updmap" ]; then
- badly_located_cfg_file="/etc/texmf/web2c/$DEFAULT_OUTPUTFILE_BASENAME"
- badly_used_prg=updmap-sys
- bad_options="--edit, --syncwithtrees, etc."
-
- if [ -e "$badly_located_cfg_file" ]; then
- printf "\
-Error: '$badly_located_cfg_file' should not exist when using the
- Debian teTeX or TeX Live packages. Presumably, you used ${badly_used_prg}
- in maintainance mode (options ${bad_options}).
- This shouldn't be done with the Debian teTeX or TeX Live packages.
- Instead, you should edit the files in ${SYSWIDE_CONFDIR}/ and run
- ${progname}, mktexlsr and ${badly_used_prg}.
- Please remove '$badly_located_cfg_file' and try again.\n" >&2
- exit 1
- fi
- fi
-
- # It could be that there is a DEFAULT_OUTPUTFILE_BASENAME file
- # in TEXMFCONFIG, which would be found by kpathsea instead of the
- # output_file. So we check for this and give a warning in case
- # the created file would be shadowed.
- if [ $syswide_mode = 0 ] && [ $output_file_specified = 0 ]; then
- OLDIFS="$IFS"
- IFS=:
- for d in "$texmfconfig"; do
- if [ ! "$d/$PATH_COMPONENT/$DEFAULT_OUTPUTFILE_BASENAME" \
- = "$output_file" ] \
- && [ -f "$d/$PATH_COMPONENT/$DEFAULT_OUTPUTFILE_BASENAME" ];
- then
- printf "\
-You are about to generate the file
- $output_file
-but at the same time you have a file
- $d/$PATH_COMPONENT/$DEFAULT_OUTPUTFILE_BASENAME
-which will shadow the former. We'll continue generating the first
-file, but to allow TeX and friends to find it, you'll have to remove the
-second one.\n"
- # Don't break out as we want to warn the user for *every*
- # shadowing file!
- fi
- done
- IFS="$OLDIFS"
- fi
-}
-
-# perform_contents_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_contents_check ()
-{
- #
- # performing contents 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_contents_check_language "$1"
- elif [ "$progname" = "update-updmap" ] ; then
- perform_contents_check_map "$1"
- elif [ "$progname" = "update-fmtutil" ] ; then
- perform_contents_check_format "$1"
- fi
- fi
-}
-
-perform_contents_check_language ()
-{
- fn="$1"
- grep -v '^\W*\(%\|=\|$\)' "$fn" | while read lang hyph comm ; do
- # now check the existence of the hyphenation file
- if [ -z $(kpsewhich -format=tex $hyph) ] ; then
- cat >&2 <<EOF
-The config file $fn references a file not in the kpathsea database:
- $hyph
-This may be ok, but it could also be a typing error.
-EOF
- fi
- done
-}
-
-perform_contents_check_map ()
-{
- fn="$1"
- grep -i '^\W*\(Mixed\)\?Map' "$fn" | 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 file not in the kpathsea database:
- $map
-Calling updmap(-sys) will break!
-This may be ok, but it could also be a typing error.
-EOF
- fi
- done
-}
-
-perform_contents_check_format ()
-{
- fn="$1"
- grep -v '^\W*\(#\|$\)' "$fn" | while read format engine hyphenation args ; do
- # this is stolen from fmtutil
- set -- $args
- pool=; tcx=
- texargs="$@"
- eval lastarg=\$$#
- inifile=$(echo $lastarg | sed 's%^\*%%')
- case "$engine" in
- mpost) kpsefmt=mpost;;
- mf|mfw|mf-nowin) kpsefmt=mf;;
- *) 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 file not in the kpathsea database:
- $inifile
-This may be ok, but it could also be a typing error.
-EOF
- fi
- done
-}
-
-
-# The list of signals to trap is taken from teTeX 3's updmap script, but they
-# have been converted to signal names because we can only rely on these on
-# POSIX systems.
-trap 'cleanup' HUP INT QUIT BUS PIPE TERM
-
-
-# -v (verbose) is here for backward compatibility only.
-TEMP=$(getopt -o +vc:o: --longoptions \
- conf-dir:,output-file:,check,quiet,help,version \
- -n "$progname" -- "$@")
-
-case $? in
- 0) : ;;
- 1) echo "$usage" >&2; exit 1 ;;
- *) exit 1 ;;
-esac
-
-# Don't remove the quotes around $TEMP!
-eval set -- "$TEMP"
-
-# Determine whether we will run in system-wide mode or in user-specific mode
-if [ "$(id -u)" -eq 0 ]; then
- syswide_mode=1
-else
- syswide_mode=0
-fi
-
-
-# ****************************************************************************
-# * Defaults *
-# ****************************************************************************
-quiet=1
-dochecks=0
-output_file_specified=0
-
-if [ $syswide_mode = 1 ]; then
- output_file="$SYSWIDE_DEFAULT_OUTPUTFILE"
-else
- # If tetex-bin is not installed, kpsewhich is not available, and we cannot
- # do anything
- if ! which kpsewhich >/dev/null; then
- echo "kpsewhich isn't available. Cannot create" \
- "$DEFAULT_OUTPUTFILE_BASENAME in user-specific mode." >&2
- exit 1
- fi
- # Is there an updmap.d/language.d directory somewhere in the expansion of
- # $TEXMFCONFIG?
- conf_dir=""
- texmfconfig=$(kpsewhich --expand-path '$TEXMFCONFIG')
- OLDIFS="$IFS"
- IFS=:
- for d in "$texmfconfig"; do
- if [ -d "$d/$CNFDIR" ]; then
- conf_dir="$d/$CNFDIR"
- break
- fi
- done
- IFS="$OLDIFS"
-
- # Does $TEXMFVAR expand to a single directory?
- texmfvar=$(kpsewhich --var-value 'TEXMFVAR')
- if ! echo "$texmfvar" | grep -e '[,:]'; then
- output_file="$texmfvar/$PATH_COMPONENT/$DEFAULT_OUTPUTFILE_BASENAME"
- else
- # We don't know what to do in this case, therefore: do nothing unless
- # the output file is specified with the correponding option.
- output_file=""
- fi
-fi
-
-
-# ****************************************************************************
-# * Options handling *
-# ****************************************************************************
-while true; do
- case "$1" in
- -c|--conf-dir) conf_dir="$2"; shift 2 ;;
- -o|--output-file)
- output_file="$2"
- output_file_specified=1
- shift 2 ;;
- --quiet) quiet=1; shift ;;
- --check) dochecks=1; shift ;;
- -v) printf "\
-${progname}'s -v option is deprecated. The default mode of operation will
-be verbose as soon as enough packages use the --quiet option. Please update
-your scripts accordingly.\n\n" >&2; quiet=0; shift ;;
- --help) echo "$usage"; exit 0 ;;
- --version) echo "$progname $version"; exit 0 ;;
- --) shift; break ;;
- *) echo "$progname: unexpected option '$1'; please report a bug." >&2
- exit 1 ;;
- esac
-done
-
-# Non-option arguments are not allowed.
-if [ $# -ne 0 ]; then
- echo "$usage" >&2
- exit 1
-fi
-
-# In user-specific mode, $conf_dir is required; let's check that.
-if [ $syswide_mode = 0 ]; then
- if [ -z "$conf_dir" ]; then
- printf "$progname: "
- cat >&2 <<EOF
-unable to determine the configuration directory; you can
-specify it with --conf-dir
-EOF
- exit 1
- fi
-
- # Make sure $conf_dir is an absolute path
- if echo "$conf_dir" | grep -e '^[^/]' >/dev/null; then
- conf_dir="${PWD}/${conf_dir}"
- fi
-fi
-
-if [ -z "$output_file" ]; then
- printf "$progname: "
- cat >&2 <<EOF
-unable to determine where to write the output; you can specify
-that with --output-file
-EOF
- exit 1
-fi
-
-perform_sanity_checks
-
-# Make sure the output directory exists (creating it if not) when running
-# in user-specific mode.
-if [ $syswide_mode = 0 ]; then
- output_dir=$(dirname "$output_file")
- if [ ! -d "$output_dir" ]; then
- [ $quiet = 0 ] && printf "Creating directory '${output_dir}'... "
- if ! mkdir -p "$output_dir"; then
- echo "$progname: unable to create directory '$output_dir'" >&2
- exit 1
- fi
- [ $quiet = 0 ] && echo "done."
- fi
-fi
-
-# ****************************************************************************
-# * Actual work *
-# ****************************************************************************
-if [ $quiet = 0 ]; then
- if [ -f "$output_file" ]; then
- printf "Regenerating '${output_file}'... "
- else
- printf "Generating '${output_file}'... "
- fi
-fi
-
-# Creating the temporary file in the output directory gives it automatically
-# the default permissions appropriate for that directory, according to the
-# user's umask. When it is complete, we'll be able to rename it atomically to
-# the desired output file, which will therefore have the right permissions.
-tempfile="${output_file}.new"
-
-confdirs="${SYSWIDE_CONFDIR}/"
-[ $syswide_mode = 0 ] && confdirs="${confdirs}\n# ${conf_dir}/"
-
-if ! printf "" > "$tempfile" ; then
- echo "$progname: cannot write to the temporary file '$tempfile'" >&2
- exit 1
-fi
-
-#
-# we have to make sure that language.def starts out the right way!
-if [ "$HYPHENMODE" = "etex" ] ; then
- printf "\
-${PCC}${PCC} e-TeX V2.0;2
-
-${PCC} Note: the first line of this file must match the corresponding line
-${PCC} in \"etex.src\" and \"etexdefs.lib\", otherwise fallback will be used.
-\n" >> "$tempfile"
-fi
-
-printf "\
-${PCC}${PCC}${PCC} This file was automatically generated by ${progname}.
-${PCC}
-${PCC} Please do not edit it directly. If you want to add or change
-${PCC} anything here, please have a look at the files in:
-${PCC}
-${PCC} $confdirs
-${PCC}
-${PCC} and invoke ${progname}.
-${PCC}
-${PCC}${PCC}${PCC}\n" >> "$tempfile"
-
-# From now on, $tempfile must be deleted on exit; therefore, cleanup() should
-# be used.
-
-if [ $syswide_mode = 1 ]; then
- find "$SYSWIDE_CONFDIR" -maxdepth 1 -type f -name '*.'${EXT}
-else
- find "$SYSWIDE_CONFDIR" "$conf_dir" -maxdepth 1 -type f -name '*.'${EXT}
-fi | swap_basename_and_dirname | LC_COLLATE=C sort | merge_files
-
-#
-# for language.def we have to select the right language at the end
-if [ "$HYPHENMODE" = "etex" ] ; then
- printf "
-${PCC}${PCC}${PCC} No changes may be made beyond this point.
-
-\\\\uselanguage {USenglish} ${PCC}${PCC}${PCC} This MUST be the last line of the file.
-" >> "$tempfile"
-fi
-
-# This is atomic.
-mv "$tempfile" "$output_file"
-
-# Check wether the generated file is decent, if all necessary files are
-# installed, etc.
-if [ "$dochecks" = 1 ] ; then
- perform_contents_check "$output_file"
-fi
-
-if [ $quiet = 0 ]; then
- printf "done.\n\n"
- echo "$progname has updated '$output_file'. If you want to"
-
- if [ "$progname" = "update-language" ]; then
- echo "enable the new patterns, you should run fmtutil-sys or fmtutil"
- echo "(with option --all, or with a particular format specified)."
- elif [ "$progname" = "update-updmap" ]; then
- echo "enable the map files with this new file, you should run" \
- "updmap-sys or updmap."
- elif [ "$progname" = "update-fmtutil" ]; then
- echo "enable the new formats, you should run fmtutil-sys or fmtutil"
- echo "(with option --all or --missing)."
- else
- echo "Unexpected \$progname: '$progname'" >&2
- exit 1
- fi
-fi
-
-# vim:set expandtab tabstop=4: #
Deleted: tex-common/branches/v3/scripts/update-fontlang.1
===================================================================
--- tex-common/branches/v3/scripts/update-fontlang.1 2012-02-24 09:41:01 UTC (rev 5053)
+++ tex-common/branches/v3/scripts/update-fontlang.1 2012-02-26 01:54:18 UTC (rev 5054)
@@ -1,198 +0,0 @@
-.TH update-fontlang 1 "2006-12-11" "Debian" "Debian User's Manual"
-
-.SH NAME
-update-updmap, update-language, update-fmtutil, update-fontlang \- update
-various TeX-related configuration files
-
-.SH SYNOPSIS
-.B update-updmap
-.RI [ options ]
-.br
-.B update-language
-.RI [ options ]
-.br
-.B update-fmtutil
-.RI [ options ]
-.br
-
-.SH DESCRIPTION
-This manual page explains briefly the usage of the three TeX configuration
-update programs
-.B update-updmap, update-language
-and \fBupdate-fmtutil\fP.
-.PP
-The
-.B update-fontlang
-script should not be called directly, but only via the three described links.
-For a more in-depth description, please see the document \fITeX on Debian\fP in
-.I /usr/share/doc/tex-common/TeX-on-Debian.txt.gz
-(also available as HTML and PDF).
-
-The programs \fBupdate-updmap\fP, \fBupdate-language\fP and
-\fBupdate-fmtutil\fP create or update the configuration files
-\fIupdmap.cfg\fP, \fIlanguage.dat\fP and \fIfmtutil.cnf\fP, respectively.
-These files define the the outline fonts available for the TeX system
-(\fIupdmap.cfg\fP), the hyphenation patterns to be loaded into LaTeX-related
-TeX formats (\fIlanguage.dat\fP), and the list of formats to be created
-(\fIfmtutil.cnf\fP).
-
-These programs can be used either in system-wide mode if called by root, or
-in a user-specific mode if called by a user without super-user privileges.
-.SH OPTIONS
-.TP
-.BI \-c\ DIR ,\ \-\-conf-dir= DIR
-directory where the user-specific configuration files are looked for in
-user-specific mode (default: \fITEXMFCONFIG/updmap.d\fP for
-\fBupdate-updmap\fP, \fITEXMFCONFIG/language.d\fP for \fBupdate-language\fP
-and \fITEXMFCONFIG/fmt.d\fP for \fBupdate-fmtutil\fP, where \fITEXMFCONFIG\fP
-is usually \fI$HOME/.texmf-config\fP).
-.TP
-.BI \-o\ FILE ,\ \-\-output-file= FILE
-file to write the output to. Per default, in system-wide mode,
-\fBupdate-updmap\fP writes to
-\fI/var/lib/texmf/web2c/updmap.cfg\fP,
-\fBupdate-language\fP writes to
-\fI/var/lib/texmf/tex/generic/config/language.dat\fP
-and
-\fBupdate-fmtutil\fP writes to
-\fI/var/lib/texmf/web2c/fmtutil.cnf\fP.
-.TP
-.B \-\-checks
-perform sanity checks on the generated config file. Don't use this
-in maintainer scripts.
-.TP
-.B \-\-quiet
-don't write anything to the standard output during normal operation
-.TP
-.B \-\-help
-print a summary of the command-line usage and exit
-.TP
-.B \-\-version
-output version information and exit
-
-.SH USAGE
-
-In system-wide mode, all three programs merge those files
-("configuration snippets") with a specific extension in the respective
-configuration directories to produce the final file. These
-configuration directories and extensions are \fIlanguage.d\fP and
-\fB.cnf\fP for \fBupdate-language\fP, \fIupdmap.d\fP and \fB.cfg\fP for
-\fBupdate-updmap\fP, and \fIfmt.d\fP and \fB.cnf\fP for \fBupdate-fmtutil\fP.
-In system-wide mode, these directories are those under \fI/etc/texmf/\fP. Both
-TeX add-on packages and local administrators can add files to these
-directories.
-
-If a package that provides such snippets is removed but not purged,
-including the snippet will likely break the system. To prevent the
-inclusion in these cases, snippets installed by \fIpackages\fP have to
-contain a magic header:
-
-# -_- DebPkgProvidedMaps -_-
-
-which local administrators should \fInot\fP remove. From the files
-with a magic header, only those files which are also listed in one of
-the files in
-.I /var/lib/tex-common/fontmap-cfg/
-for \fBupdate-updmap\fP,
-.I /var/lib/tex-common/language-cnf/
-for \fBupdate-language\fP, and
-.I /var/lib/tex-common/fmtutil-cnf/
-for \fBupdate-fmtutil\fP, are actually included into the final output
-file. This way, local changes to the configuration can be preserved
-while the package is in state 'rc' (that is, the package is removed, but its
-configuration files are still present). For details about this mechanism,
-package maintainers should consult the Debian TeX Policy. As a
-special case, the files for JadeTeX and xmlTeX are only included if
-there is already a file for the LaTeX format (see \fITeX on Debian\fP
-for details).
-
-The user-specific mode provides a way for a non-admin user to override
-system-wide settings. In this mode,
-\fBupdate-language\fP writes to
-\fITEXMFVAR/tex/generic/config/language.dat\fP,
-\fBupdate-updmap\fP writes to
-\fITEXMFVAR/web2c/updmap.cfg\fP, and
-\fBupdate-fmtutil\fP writes to
-\fITEXMFVAR/web2c/fmtutil.cnf\fP, where \fITEXMFVAR\fP is usually
-\fI$HOME/.texmf-var\fP.
-Furthermore, files present within the user-specific configuration
-directories are included \fIin addition\fP to the files present in the
-system-wide configuration directories. In case the same filename
-exists in the system-wide configuration directory and the
-user-specific configuration directory, the user-specific file is used
-instead of the system-wide one. The user-specific configuration directories
-are
-\fITEXMFCONFIG/updmap.d\fP for \fBupdate-updmap\fP,
-\fITEXMFCONFIG/language.d\fP for \fBupdate-language\fP and
-\fITEXMFCONFIG/fmt.d\fP
-for \fBupdate-fmtutil\fP, where \fITEXMFCONFIG\fP is usually
-\fI$HOME/.texmf-config\fP. The system-wide configuration directories have the
-same names, but are located in \fI/etc/texmf/\fP instead of \fITEXMFCONFIG\fP.
-
-Note that changes introduced by updates of packages are \fInot\fP
-propagated to the user's configuration files. This has to be done by hand.
-
-.SH FILES
-.TP
-.B /var/lib/texmf/tex/generic/config/language.dat
-This file is generated or updated by \fBupdate-language\fP in system-wide
-mode and contains a list of the hyphenation patterns loaded into
-LaTeX-based formats by \fBfmtutil-sys\fP.
-.TP
-.B /var/lib/texmf/web2c/updmap.cfg
-This file is generated or updated by \fBupdate-updmap\fP in system-wide
-mode and contains a list of map files to be included
-into the lists of outline fonts generated by \fBupdmap-sys\fP.
-.TP
-.B /var/lib/texmf/web2c/fmtutil.cnf
-This file is generated or updated by \fBupdate-fmtutil\fP in system-wide
-mode and contains a list of formats to be generated by \fBfmtutil-sys\fP.
-.TP
-.B /etc/texmf/language.d/\fIname\fP.cnf
-Input files for \fBupdate-language\fP
-.TP
-.B /etc/texmf/updmap.d/\fIname\fP.cfg
-Input files for \fBupdate-updmap\fP
-.TP
-.B /etc/texmf/fmt.d/\fIname\fP.cnf
-Input files for \fBupdate-fmtutil\fP
-.TP
-.B /var/lib/tex-common/language-cnf/\fIpackage\fP.list
-Lists the file(s) installed by \fIpackage\fP in \fI/etc/texmf/language.d/\fP.
-.TP
-.B /var/lib/tex-common/fontmap-cfg/\fIpackage\fP.list
-Lists the file(s) installed by \fIpackage\fP in \fI/etc/texmf/updmap.d/\fP.
-.TP
-.B /var/lib/tex-common/fmtutil-cnf/\fIpackage\fP.list
-Lists the file(s) installed by \fIpackage\fP in \fI/etc/texmf/fmt.d/\fP.
-
-.SH SEE ALSO
-
-.TP
-.B updmap(1), updmap-sys(1), fmtutil(1), fmtutil-sys(1)
-The programs actually using the generated configuration files
-(\fIupdmap.cfg\fP, \fIlanguage.dat\fP and \fIfmtutil.cnf\fP).
-.TP
-.B TeX on Debian Documentation
-to be found in \fI/usr/share/doc/tex-common/TeX-on-Debian.txt.gz\fP (also
-available as HTML and PDF), describing in more detail how to setup
-and maintain a TeX system in Debian. It also includes details on user-specific
-configuration.
-.TP
-.B Debian TeX Policy
-to be found in \fI/usr/share/doc/tex-common/Debian-TeX-Policy.txt.gz\fP (also
-available as HTML and PDF), describing the internals and the TeX Policy
-established on the Debian TeX mailing-list
-(debian-tex-maint at lists.debian.org). Intended audience is mainly developers
-packaging TeX-related resources for Debian.
-.TP
-.B dh_installtex(1)
-a debhelper-like script for managing the installation of files into the
-system-wide configuration directories; this script helps to write Debian
-packages containing TeX-related resources that conform to the Debian TeX
-Policy.
-
-.SH AUTHOR
-This manual page was written by Norbert Preining <preining at debian.org>
-for the Debian distribution (and may be used by others). It was later updated
-by Florent Rougon <f.rougon at free.fr>.
Added: tex-common/branches/v3/scripts/update-updmap
===================================================================
--- tex-common/branches/v3/scripts/update-updmap (rev 0)
+++ tex-common/branches/v3/scripts/update-updmap 2012-02-26 01:54:18 UTC (rev 5054)
@@ -0,0 +1,194 @@
+#!/bin/bash -e
+#
+# update-updmap --- Generate updmap.cfg for all the trees
+# Copyright (C) 2012 Norbert Preining
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 dated June, 1991.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING. If not, write to the
+# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+
+version="1.0"
+progname=$(basename "$0")
+
+SNIPPET_BASE=/var/lib/texmf/fontmap-cfg
+# this needs to be kept in sync with dh_installtex
+COMPONENTS="texmf texlive"
+
+
+usage="Usage: $progname [OPTION...]
+Generate updmap configuration files.
+
+Options:
+ --checks perform sanity checks on the generated config file
+ --quiet don't write anything to the standard output during
+ normal operation
+ --help display this help message and exit
+ --version output version information and exit"
+
+
+# This ensures that if $tempfile is in the *environment*, we won't erase
+# the file it could point to in case the script is killed by a signal before
+# it has had a chance to even create its temporary file.
+tempfile=""
+
+
+cleanup()
+{
+ rc=$?
+ [ -n "$tempfile" ] && rm -f "$tempfile"
+ exit $rc
+}
+
+perform_contents_check ()
+{
+ fn="$1"
+ grep -i '^\W*\(Mixed\|Kanji\)\?Map' "$fn" | 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 file not in the kpathsea database:
+ $map
+Calling updmap(-sys) will break!
+This may be ok, but it could also be a typing error.
+EOF
+ fi
+ done
+}
+
+# The list of signals to trap is taken from teTeX 3's updmap script, but they
+# have been converted to signal names because we can only rely on these on
+# POSIX systems.
+trap 'cleanup' HUP INT QUIT BUS PIPE TERM
+
+
+# -v (verbose) is here for backward compatibility only.
+TEMP=$(getopt -o +vc:o: --longoptions \
+ check,quiet,help,version \
+ -n "$progname" -- "$@")
+
+case $? in
+ 0) : ;;
+ 1) echo "$usage" >&2; exit 1 ;;
+ *) exit 1 ;;
+esac
+
+# Don't remove the quotes around $TEMP!
+eval set -- "$TEMP"
+
+# ****************************************************************************
+# * Defaults *
+# ****************************************************************************
+quiet=0
+dochecks=0
+
+# ****************************************************************************
+# * Options handling *
+# ****************************************************************************
+while true; do
+ case "$1" in
+ --quiet) quiet=1; shift ;;
+ --check) dochecks=1; shift ;;
+ -v) printf "\
+${progname}'s -v option is deprecated. The default mode of operation will
+be verbose as soon as enough packages use the --quiet option. Please update
+your scripts accordingly.\n\n" >&2; quiet=0; shift ;;
+ --help) echo "$usage"; exit 0 ;;
+ --version) echo "$progname $version"; exit 0 ;;
+ --) shift; break ;;
+ *) echo "$progname: unexpected option '$1'; please report a bug." >&2
+ exit 1 ;;
+ esac
+done
+
+# Non-option arguments are not allowed.
+if [ $# -ne 0 ]; then
+ echo "$usage" >&2
+ exit 1
+fi
+
+# ****************************************************************************
+# * Actual work *
+# ****************************************************************************
+
+for tree in $COMPONENTS ; do
+ if [ ! -d "$SNIPPET_BASE/$tree" ] ; then
+ if [ $quiet = 0 ]; then
+ printf "$progname: skipping $tree\n";
+ fi
+ continue;
+ fi
+ if [ $tree = "texmf" ] ; then
+ output_file=/usr/share/texmf/web2c/updmap.cfg
+ elif [ $tree = "texlive" ] ; then
+ output_file=/usr/share/texlive/texmf-dist/web2c/updmap.cfg
+ else
+ echo "$progname: that cannot happen!" >&2
+ exit 1
+ fi
+ # TODO TODO
+ # create output dir in any case ...
+ mkdir -p $(dirname $output_file)
+
+ #
+ if [ $quiet = 0 ]; then
+ if [ -f "$output_file" ]; then
+ printf "Regenerating '${output_file}'... "
+ else
+ printf "Generating '${output_file}'... "
+ fi
+ fi
+
+ # Creating the temporary file in the output directory gives it automatically
+ # the default permissions appropriate for that directory, according to the
+ # user's umask. When it is complete, we'll be able to rename it atomically to
+ # the desired output file, which will therefore have the right permissions.
+ tempfile="updmap.$tree.new"
+
+ if ! printf "" > "$tempfile" ; then
+ echo "$progname: cannot write to the temporary file '$tempfile'" >&2
+ exit 1
+ fi
+
+ printf "\
+### This file was automatically generated by ${progname}.
+#
+# Any local change will be overwritten. Please see the documentation
+# of updmap on how to override things from here.
+#
+###\n" >> "$tempfile"
+
+ # From now on, $tempfile must be deleted on exit; therefore, cleanup() should
+ # be used.
+
+ find "$SNIPPET_BASE/$tree" -maxdepth 1 -type f -name '*.cfg' \
+ -exec cat '{}' \; >> "$tempfile"
+
+ # This is atomic.
+ mv "$tempfile" "$output_file"
+
+ # Check wether the generated file is decent, if all necessary files are
+ # installed, etc.
+ if [ "$dochecks" = 1 ] ; then
+ perform_contents_check "$output_file"
+ fi
+
+ if [ $quiet = 0 ]; then
+ printf "done.\n\n"
+ echo "$progname has updated '$output_file'. If you want to";
+ echo "enable the map files with this new file, you should run" \
+ "updmap-sys or updmap."
+ fi
+done
+
+
+# vim:set expandtab tabstop=4 autoindent: #
Property changes on: tex-common/branches/v3/scripts/update-updmap
___________________________________________________________________
Added: svn:executable
+ *
More information about the Debian-tex-commits
mailing list