[subversion-commit] SVN tetex commit + diffs: r243 -
tex-common/trunk/doc
Ralf Stubner
stubner-guest at costa.debian.org
Sun Oct 16 22:42:45 UTC 2005
Author: stubner-guest
Date: 2005-10-16 22:42:42 +0000 (Sun, 16 Oct 2005)
New Revision: 243
Modified:
tex-common/trunk/doc/Debian-TeX-Policy.sgml
Log:
* add appendix with sample code
Modified: tex-common/trunk/doc/Debian-TeX-Policy.sgml
===================================================================
--- tex-common/trunk/doc/Debian-TeX-Policy.sgml 2005-10-16 17:08:26 UTC (rev 242)
+++ tex-common/trunk/doc/Debian-TeX-Policy.sgml 2005-10-16 22:42:42 UTC (rev 243)
@@ -469,6 +469,12 @@
<prgn>update-updmap</prgn>, and in the final map files by
<prgn>updmap-sys</prgn>).
</p>
+ <p>
+ Implementations for the configuration scheme described in this
+ section can be found in <ref id="appen-sample-font"> and is
+ implemented in the <prgn>debhelper</prgn> program
+ <prgn>dh_installtexfonts</prgn>.
+ </p>
</sect1>
<sect1>
@@ -571,6 +577,156 @@
</sect>
</chapt>
+ <appendix>
+ <heading>Sample code</heading>
+ <p>
+ This section contains sample code that implements the
+ recommodations of this document.
+ </p>
+ <sect id="appen-sample-font">
+ <heading>Sample code for font packages</heading>
+ <p>
+ Sample postinst script:
+<example>
+#
+# postinst-texfonts
+#
+# postinst snippets for installing fonts for TeX
+#
+# Author: Florent Rougon <f.rougon at free.fr>
+#
+update_fontmaps()
+{
+ update-updmap --quiet
+ # mktexlsr is recommended now because updmap-sys relies heavily on
+ # Kpathsea to locate updmap.cfg and the map files. Also, it is slightly
+ # better not to specify a particular directory to refresh because
+ # updmap.cfg is typically found in $TEXMFSYSVAR while the map files are in
+ # $TEXMFMAIN.
+ # According to the Debian TeX policy, running mktexlsr and updmap-sys
+ # should work as long as tex-common is configured and these files are
+ # available (general Debian policy wouldn't assure that without this
+ # override from the Debian TeX policy).
+ if which mktexlsr >/dev/null; then mktexlsr; fi
+ if which updmap-sys >/dev/null; then
+ printf "Running updmap-sys... "
+ updmap-sys --quiet
+ echo "done."
+ fi
+
+ return 0
+}
+
+case "$1" in
+ configure|abort-upgrade|abort-remove|abort-deconfigure)
+ update_fontmaps
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+</example>
+ </p>
+ <p>
+ Sample postrm script:
+<example>
+#
+# postrm-texfonts
+#
+# postrm snippets for installing fonts for TeX
+#
+# Author: Florent Rougon <f.rougon at free.fr>
+#
+tell_that_errors_are_ok()
+{
+ # Cheap option handling...
+ if [ "$1" = -n ]; then
+ prog="$2"
+ endwith=' '
+ else
+ prog="$1"
+ endwith='\n'
+ fi
+
+ # According to the Debian TeX policy, running mktexlsr and updmap-sys
+ # should work as long as tex-common is configured and these files are
+ # available (general Debian policy wouldn't assure that without this
+ # override from the Debian TeX policy).
+ printf "\
+Trying to run '$prog' (error messages can be ignored if tex-common
+is not configured)...$endwith"
+
+ return 0
+}
+
+# The function name is *try_to*_update_fontmaps because the following
+# scenario might happen:
+# 1. this package is deconfigured
+# 2. tex-common and tetex-bin are removed
+# 3. this package is removed or purged
+#
+# (cf. Policy § 6.5, step 2, about a conflicting package being removed due
+# to the installation of the package being discussed).
+#
+# In this case, update-updmap, mktexlsr and updmap-sys would all be gone once
+# tex-common and tetex-bin are removed, so we must append "|| true" to their
+# calls.
+try_to_update_fontmaps()
+{
+ # Don't print alarming error messages if the programs aren't even
+ # available.
+ if which update-updmap >/dev/null; then
+ tell_that_errors_are_ok -n update-updmap
+ update-updmap --quiet || true
+ echo "done."
+ fi
+ # mktexlsr is recommended now because updmap-sys relies heavily on
+ # Kpathsea to locate updmap.cfg and the map files. Also, it is slightly
+ # better not to specify a particular directory to refresh because
+ # updmap.cfg is typically found in $TEXMFSYSVAR while the map files are in
+ # $TEXMFMAIN.
+ if which mktexlsr >/dev/null; then
+ tell_that_errors_are_ok mktexlsr
+ mktexlsr || true
+ echo "done."
+ fi
+
+ if which updmap-sys >/dev/null; then
+ tell_that_errors_are_ok -n updmap-sys
+ updmap-sys --quiet || true
+ echo "done."
+ fi
+
+ return 0
+}
+
+case "$1" in
+ remove|disappear)
+ try_to_update_fontmaps
+ ;;
+
+ purge)
+ # Supposing updmap.cfg & Co are clean (which I think is a reasonable
+ # assumption), we don't need to call try_to_update_fontmaps().
+ # Calling it on remove _and_ on purge just for hypothetical users
+ # who would break their config before purging this package seems to
+ # be more annoying than useful (it takes a lot of time).
+ ;;
+
+ upgrade|failed-upgrade|abort-upgrade|abort-install)
+ ;;
+
+ *)
+ echo "postrm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+</example>
+ </p>
+ </sect>
+ </appendix>
</book>
</debiandoc>
More information about the Pkg-tetex-commits
mailing list