Should we move texmf.cnf back to /etc? (was: CVS frank tetex-bin: added ucf support. It's tested and works, but not all md5sums have been added so far)
Hilmar Preusse <hille42@web.de> wrote:
>> Log message:
>> added ucf support. It's tested and works, but not all md5sums have been added so far
>>
> I guess, you've seen #196582?
I wasn't aware of it, now I had a look. The patch fits well into my
scheme. However, Atsuhito was reluctant to apply it.
I didn't read every word of the lengthy discussion in this bug report,
so I might have missed something. But I didn't quite understand why we
shouldn't do it that way. The benefits I see:
- updated-texmf works, so that packages or updates of tetex-bin can
change settings
- users have the option of editing /etc/texmf/texmf.cnf directly, or
editing/adding files in /etc/texmf/texmf.d/
- ucf even tries a three-way-merge
What I didn't like in Tore's patch was that he deleted the "do not
edit"-remarks in the generated file completely. I would replace it by
%%% This file is automatically generated by update-texmf
%
% Please do not edit this file directly. Changes made by users will not be
% overwritten. However, if you want a smooth upgrade, please edit the files
% in ${CNFDIR}, or create an additional one (with the extension '.cnf'),
% and invoke update-texmf.
%
%%%
because being asked by ucf and having to look at a three-way-diff on
every install/upgrade is annoying.
There's an other problem with generated files in /etc/: People might try
to put this on a ro partition. I have added a check for this - it
shouldn't affect package installations, however.
So here's the patch against our current CVS, have a look at it:
--- tetex-bin-2.0.2-CVS/debian/config.orig Wed Mar 3 08:21:04 2004
+++ tetex-bin-2.0.2-CVS/debian/config Wed Mar 24 17:18:44 2004
@@ -13,9 +13,6 @@
. /usr/share/debconf/confmodule || exit
db_version 2.0
-# texmf.cnf handling
-db_input medium tetex-bin/texmf || true
-db_go || true
# fmtutil.cnf handling
db_input low tetex-bin/fmtutil || true
db_go || true
--- tetex-bin-2.0.2-CVS/debian/rules.orig Wed Mar 24 16:51:04 2004
+++ tetex-bin-2.0.2-CVS/debian/rules Wed Mar 24 16:51:43 2004
@@ -172,7 +172,7 @@
cp texmf.d/*.cnf $(sharedir)/$(package)
cp debian/md5sums/*md5sum $(sharedir)/$(package)
install -m 755 debian/update-texmf debian/$(package)/usr/sbin
- #(cd $(debvar)/web2c/; ln -s $(etcdir)/texmf.cnf .)
+ (cd $(debvar)/web2c/; ln -s $(etcdir)/texmf.cnf .)
cp debian/update-texmf.8 $(sharedir)/man/man8/
# update-fmtutil stuffs #########
cp $(debvar)/web2c/fmtutil.cnf $(debetc)/fmt.d/00tetex.cnf
--- tetex-bin-2.0.2-CVS/debian/postinst.orig Sun Mar 21 20:21:37 2004
+++ tetex-bin-2.0.2-CVS/debian/postinst Wed Mar 24 17:19:55 2004
@@ -86,33 +86,8 @@
# should remove at purge; ${ETXMFC}.dpkg-old ${EFMTUC}.dpkg-old (tetex-bin)
# ${EUMAPC}.dpkg-old ${ELDAT}.dpkg-old (tetex-base?)
-# texmf.cnf handling
-db_get tetex-bin/texmf || true
-if [ X"$RET" = X"true" ]; then
- if dpkg --compare-versions "$2" lt 1.0.7+20011202-5.1; then
- if [ -f ${ETXMFC} ]; then
- echo " ${ETXMFC} is no longer used and a file generated by ${UPDTXMF}"
- echo "will be used from now on. Old ${ETXMFC} will be reserved as"
- echo "${ETXMFC}.dpkg-old for your reference."
- fi
- fi
-# rename unused texmf.cnf
- if [ -f ${ETXMFC} ]; then mv -f ${ETXMFC} ${ETXMFC}.dpkg-old; fi
- if [ -L ${VTXMFC} ]; then rm -f ${VTXMFC}; fi
- if [ -x ${UPDTXMF} ]; then ${UPDTXMF} -v; fi
-else
- if [ ! -f ${ETXMFC} ]; then
- if [ -f ${ETXMFC}.dpkg-old ]; then
- mv ${ETXMFC}.dpkg-old ${ETXMFC}
- else
- cp ${TXMFCTPL} ${ETXMFC}
- fi
- fi
- if [ ! -L ${VTXMFC} ]; then
- rm -f ${VTXMFC}
- (cd ${VDIR}; ln -s ${ETXMFC} . )
- fi
-fi
+# generate /etc/texmf/texmf.cnf
+if [ -x ${UPDTXMF} ] ; then ${UPDTXMF} -v; fi
# fmtutil.cnf handling
db_get tetex-bin/fmtutil || true
--- tetex-bin-2.0.2-CVS/debian/postrm.orig Sat Mar 20 08:34:57 2004
+++ tetex-bin-2.0.2-CVS/debian/postrm Wed Mar 24 17:06:51 2004
@@ -5,22 +5,31 @@
TEXMFD=/etc/texmf/texmf.d
FMTD=/etc/texmf/fmt.d
VLDAT=/var/lib/texmf/language.dat
-TEXMFD_UCF="05TeXMF 15Plain 45TeXinputs 55Fonts 65BibTeX 75DviPS 85Misc 90TeXDoc 95NonPath"
+TEXMFD_UCF="05TeXMF.cnf 15Plain.cnf 45TeXinputs.cnf 55Fonts.cnf 65BibTeX.cnf \
+ 75DviPS.cnf 85Misc.cnf 90TeXDoc.cnf 95NonPath.cnf"
rm -f /usr/lib/texmf/web2c /usr/share/texmf/web2c || true
-if [ x"$1" = xpurge ] ; then
- # handle ucf files
+# this is borrowed from Tore Andersons LRRD packages
+purge_ucf_file () {
+ local conffile="$1"
+ # this list is from dpkg-1.10.9/include/dpkg.h.in
+ for ext in '~' '%' .bak .dpkg-tmp .dpkg-new .dpkg-old .dpkg-dist; do
+ rm -f "${conffile}${ext}"
+ done
+ rm -f "${conffile}"
if [ -x /usr/bin/ucf ]; then
- purgefile(){ ucf --purge $1; rm -f $1 $1.dpkg-dist $1.dpkg-old; }
- else
- purgefile(){ rm -f $1 $1.dpkg-dist $1.dpkg-old; }
+ ucf --purge "${conffile}"
fi
- for file in ${TEXMFD_UCF}; do
- purgefile /etc/texmf/texmf.d/$file.cnf
+}
+
+if [ x"$1" = xpurge ] ; then
+ # handle ucf files
+ for file in ${TEXMFD_UCF} ${TEXMFC}; do
+ purge_ucf_file /etc/texmf/texmf.d/$file
done
- rm -f ${TEXMFC}* ${FMTCNF}* ${VLDAT}*
+ rm -f ${FMTCNF}* ${VLDAT}*
# rm -rf ${TEXMFD} ## this could delete configuration files of other packages
# rm -rf ${FMTD} ## this could delete configuration files of other packages
rm -rf /var/lib/texmf/web2c
--- tetex-bin-2.0.2-CVS/debian/templates.orig Mon Feb 23 03:34:06 2004
+++ tetex-bin-2.0.2-CVS/debian/templates Wed Mar 24 15:55:59 2004
@@ -1,20 +1,3 @@
-Template: tetex-bin/texmf
-Type: boolean
-Default: true
-_Description: Use update-texmf to automatically generate texmf.cnf?
- The file texmf.cnf is the central configuration file of TeX.
- Automatic generation is recommended to make the setup work with other TeX
- related packages.
- .
- To customize your TeX setup, you should not edit texmf.cnf directly but
- instead modify the files in /etc/texmf/texmf.d/ and the generated texmf.cnf
- would be placed under /var/lib/texmf/web2c.
- .
- Don't accept this if you don't want to overwrite texmf.cnf from a previous
- version. Then you should modify /etc/texmf/texmf.cnf manually.
- REMARK: Automatic installation of some other TeX related packages could
- fail in this case.
-
Template: tetex-bin/fmtutil
Type: boolean
Default: true
--- tetex-bin-2.0.2-CVS/debian/update-texmf.orig Thu Jul 17 09:51:40 2003
+++ tetex-bin-2.0.2-CVS/debian/update-texmf Wed Mar 24 17:31:50 2004
@@ -2,9 +2,12 @@
# update-texmf
# License: GPL
+set -e
+
TXMF=/etc/texmf
CNFDIR=${TXMF}/texmf.d
VARD=/var/lib/texmf/web2c
+TMPTXMF=`mktemp texmfXXXXXXX`
if [ "x$1" = "x-v" ] ; then
VERBOSE=true
@@ -12,41 +15,52 @@
VERBOSE=false
fi
-if [ -L "${VARD}/texmf.cnf" ]; then
- echo "Didn't run update-texmf as you requested!"
- exit 0
+# test wether /etc isn't mounted read-only
+if touch /etc/texmf/is_rw 2>/dev/null; then
+ rm -f /etc/texmf/is_rw
+else
+ echo "Directory /etc/texmf/ not writeable. Exiting."
+ exit 1
fi
if [ -f ${CNFDIR}/05TeXMF.cnf ] ; then
CNFFILES=`/bin/ls -1 ${CNFDIR}/*.cnf`
else
-echo "update-texmf; Something seems wrong."
+ echo "update-texmf: Basic configuration file ${CNFDIR}/05TeXMF.cnf missing." >&2
+ echo "Exiting." >&2
exit 1
fi
if [ "${VERBOSE}" = "true" ]; then
- if [ -f "${VARD}/texmf.cnf" ]; then
- echo -n "Regenerating ${VARD}/texmf.cnf ... " >&2
+ if [ -f "${TXMF}/texmf.cnf" ]; then
+ echo -n "Regenerating ${TXMF}/texmf.cnf ... " >&2
else
- echo -n "Generating ${VARD}/texmf.cnf ... " >&2
+ echo -n "Generating ${TXMF}/texmf.cnf ... " >&2
fi
fi
-(echo "%%% This file is automatically generated by update-texmf"; \
-echo "%"; \
-echo "% Please do not edit this file directly. If you want to change or add"; \
-echo "% anything please take a look at the files in ${CNFDIR}, and"; \
-echo "% invoke update-texmf."; \
-echo "%"; \
-echo "%%%" ) > ${VARD}/texmf.cnf_$$
+cat > ${TMPTXMF} <<EOF
+%%% This file is automatically generated by update-texmf
+%
+% Please do not edit this file directly. Changes made by users will not be
+% overwritten. However, if you want a smooth upgrade, please edit the files
+% in ${CNFDIR}, or create an additional one (with the extension '.cnf'),
+% and invoke update-texmf.
+%
+%%%
+
+EOF
for i in ${CNFFILES}; do
- echo "%%% From file: $i" >> ${VARD}/texmf.cnf_$$
- cat $i >> ${VARD}/texmf.cnf_$$
- echo "%%% End of file: $i" >> ${VARD}/texmf.cnf_$$
+ echo "%%% From file: $i" >> ${TMPTXMF}
+ cat $i >> ${TMPTXMF}
+ echo "%%% End of file: $i" >> ${TMPTXMF}
done
#cat ${CNFFILES} >> ${VARD}/texmf.cnf_$$
-mv ${VARD}/texmf.cnf_$$ ${VARD}/texmf.cnf
+
+# now, invoke ucf, and then remove the suggested texmf.cnf.
+ucf --debconf-ok --three-way ${TMPTXMF} ${TXMF}/texmf.cnf
+rm ${TMPTXMF}
if [ "${VERBOSE}" = "true" ]; then
echo "done"
Regards, Frank
--
Frank Küster, Biozentrum der Univ. Basel
Abt. Biophysikalische Chemie
Reply to: