On Do, 20 Sep 2012, Hideki Yamane wrote:
> > I am currently testing such an approach, but I am not sure what is the
> > better option for getting it into wheezy ...

Did loads of tests now:
install from purged state: ok
update from old installed/unchanged: ok
update from old removed/unchanged: ok
update from old install/changed: debconf question
update from old removed/changed (in .bak): debconf question

I have added a bit of code to 
        latex209-bin.preinst
to make sure that debconf is asking only in actually changed cases.
THe new conffile has an additional header (necessary) and that
should not create debconf questions.

Attached is a debdiff, if someone has interest.

Best wishes

Norbert
------------------------------------------------------------------------
Norbert Preining            preining@{jaist.ac.jp, logic.at, debian.org}
JAIST, Japan                                 TeX Live & Debian Developer
DSA: 0x09C5B094   fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094
------------------------------------------------------------------------
BEALINGS
The unsavoury parts of a moat which a knight has to pour out of his
armour after being the victim of an araglin (q.v.). In medieval
Flanders, soup made from bealins was a very slightly sought-after
delicacy.
                        --- Douglas Adams, The Meaning of Liff
diff -Nru latex209-25.mar.1992/debian/changelog latex209-25.mar.1992/debian/changelog
--- latex209-25.mar.1992/debian/changelog	2012-05-18 15:08:59.000000000 +0900
+++ latex209-25.mar.1992/debian/changelog	2012-09-20 14:26:01.000000000 +0900
@@ -1,3 +1,15 @@
+latex209 (25.mar.1992-12.6) UNRELEASED; urgency=low
+
+  * Non-maintainer upload.
+  * fix RC bug (Closes: #669382) (create files that are not removed) by:
+    - remove all maintainer scripts
+    - create the necessary code with dh_installtex
+    - add necessary build-dep on tex-common
+  * add latex209-bin.preinst to fix up old conffile so that debconf does
+    not ask unnecessary questions
+
+ -- Norbert Preining <prein...@debian.org>  Thu, 20 Sep 2012 14:24:28 +0900
+
 latex209 (25.mar.1992-12.5) unstable; urgency=low
 
   * Non-maintainer upload.
diff -Nru latex209-25.mar.1992/debian/control latex209-25.mar.1992/debian/control
--- latex209-25.mar.1992/debian/control	2012-05-15 15:25:27.000000000 +0900
+++ latex209-25.mar.1992/debian/control	2012-09-20 14:24:26.000000000 +0900
@@ -2,7 +2,7 @@
 Section: tex
 Priority: optional
 Maintainer: TSUCHIYA Masatoshi <tsuch...@namazu.org>
-Build-Depends: debhelper (>> 5.0.0)
+Build-Depends: debhelper (>> 5.0.0), tex-common (>= 3)
 Standards-Version: 3.8.4
 Uploaders: Atsuhito Kohda <ko...@debian.org>
 
diff -Nru latex209-25.mar.1992/debian/latex209-base.postinst latex209-25.mar.1992/debian/latex209-base.postinst
--- latex209-25.mar.1992/debian/latex209-base.postinst	2012-05-15 15:17:15.000000000 +0900
+++ latex209-25.mar.1992/debian/latex209-base.postinst	1970-01-01 09:00:00.000000000 +0900
@@ -1,44 +0,0 @@
-#! /bin/sh
-# postinst script for latex209-base
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-#        * <postinst> `configure' <most-recently-configured-version>
-#        * <old-postinst> `abort-upgrade' <new version>
-#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
-#          <new-version>
-#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
-#          <failed-install-package> <version> `removing'
-#          <conflicting-package> <version>
-# for details, see /usr/doc/packaging-manual/
-#
-# quoting from the policy:
-#     Any necessary prompting should almost always be confined to the
-#     post-installation script, and should be protected with a conditional
-#     so that unnecessary prompting doesn't happen if a package's
-#     installation fails and the `postinst' is called with `abort-upgrade',
-#     `abort-remove' or `abort-deconfigure'.
-
-TEXMF=/usr/share/texmf
-
-case "$1" in
-    configure)
-	mktexlsr $TEXMF
-	;;
-    abort-upgrade|abort-remove|abort-deconfigure)
-	;;
-    *)
-        echo "postinst called with unknown argument \`$1'" >&2
-        exit 0
-	;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
diff -Nru latex209-25.mar.1992/debian/latex209-base.postrm latex209-25.mar.1992/debian/latex209-base.postrm
--- latex209-25.mar.1992/debian/latex209-base.postrm	2012-05-15 15:16:28.000000000 +0900
+++ latex209-25.mar.1992/debian/latex209-base.postrm	1970-01-01 09:00:00.000000000 +0900
@@ -1,39 +0,0 @@
-#! /bin/sh
-# postrm script for latex209-base
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-#        * <postrm> `remove'
-#        * <postrm> `purge'
-#        * <old-postrm> `upgrade' <new-version>
-#        * <new-postrm> `failed-upgrade' <old-version>
-#        * <new-postrm> `abort-install'
-#        * <new-postrm> `abort-install' <old-version>
-#        * <new-postrm> `abort-upgrade' <old-version>
-#        * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
-# for details, see /usr/doc/packaging-manual/
-
-TEXMF=/usr/share/texmf
-
-case "$1" in
-    remove|purge)
-	if [ -x /usr/bin/mktexlsr ]; then
-            mktexlsr $TEXMF
-        fi
-	;;
-    upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
-        ;;
-    *)
-        echo "postrm called with unknown argument \`$1'" >&2
-        exit 0
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
diff -Nru latex209-25.mar.1992/debian/latex209-bin.postinst latex209-25.mar.1992/debian/latex209-bin.postinst
--- latex209-25.mar.1992/debian/latex209-bin.postinst	2010-04-07 20:51:51.000000000 +0900
+++ latex209-25.mar.1992/debian/latex209-bin.postinst	1970-01-01 09:00:00.000000000 +0900
@@ -1,86 +0,0 @@
-#! /bin/sh 
-# postinst script for latex209-bin
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-#        * <postinst> `configure' <most-recently-configured-version>
-#        * <old-postinst> `abort-upgrade' <new version>
-#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
-#          <new-version>
-#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
-#          <failed-install-package> <version> `removing'
-#          <conflicting-package> <version>
-# for details, see /usr/doc/packaging-manual/
-#
-# quoting from the policy:
-#     Any necessary prompting should almost always be confined to the
-#     post-installation script, and should be protected with a conditional
-#     so that unnecessary prompting doesn't happen if a package's
-#     installation fails and the `postinst' is called with `abort-upgrade',
-#     `abort-remove' or `abort-deconfigure'.
-
-update_fmtutil()
-{
-    d=/etc/texmf/fmt.d
-    f=${d}/25latex209.cnf
-    b=${d}/25latex209.bak
-    if [ ! -f ${f} ] ; then
-	if [ -f ${b} ] ; then
-	    echo "Preserved \`25latex209.bak' is found."
-	    mv -f ${b} ${f}
-	else
-	    cat <<EOF >${f}
-#
-# LaTeX 2.09
-#
-# format	engine		pattern-file	arguments
-latex209	tex		-		latex209.ini
-
-EOF
-	fi
-    fi
-    update-fmtutil
-}
-
-make_format()
-{
-    if [ -x /usr/bin/fmtutil-sys ]; then
-	UTIL=fmtutil-sys
-    else
-	UTIL=fmtutil
-    fi
-    target=$1
-    formats=/var/lib/texmf/web2c/tex
-    echo "Make the format file of \`${target}'. This may take some time. ..."
-    if ( ${UTIL} --byfmt ${target} ) ; then
-	${MT_MKTEXUPD=`kpsewhich --format='web2c files' mktexupd`} \
-	    ${formats} ${target}.fmt
-	echo "The format file of \`${target}' is built successfully." 1>&2
-    else
-	echo "The format file of \`${target}' is NOT built successfully." 1>&2
-	exit 1
-    fi
-}
-
-case "$1" in
-    configure)
-	update_fmtutil
-	make_format latex209
-	;;
-    abort-upgrade|abort-remove|abort-deconfigure)
-	;;
-    *)
-        echo "postinst called with unknown argument \`$1'" >&2
-        exit 0
-	;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
diff -Nru latex209-25.mar.1992/debian/latex209-bin.postrm latex209-25.mar.1992/debian/latex209-bin.postrm
--- latex209-25.mar.1992/debian/latex209-bin.postrm	2010-04-06 10:50:14.000000000 +0900
+++ latex209-25.mar.1992/debian/latex209-bin.postrm	1970-01-01 09:00:00.000000000 +0900
@@ -1,48 +0,0 @@
-#!/bin/sh
-# postrm script for latex209-bin
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-#        * <postrm> `remove'
-#        * <postrm> `purge'
-#        * <old-postrm> `upgrade' <new-version>
-#        * <new-postrm> `failed-upgrade' <old-version>
-#        * <new-postrm> `abort-install'
-#        * <new-postrm> `abort-install' <old-version>
-#        * <new-postrm> `abort-upgrade' <old-version>
-#        * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
-# for details, see /usr/doc/packaging-manual/
-
-case "$1" in
-    purge)
-	rm -f /etc/texmf/fmt.d/25latex209.cnf
-	rm -f /etc/texmf/fmt.d/25latex209.bak
-	if [ -x /usr/sbin/update-fmtutil ]; then
-            update-fmtutil
-        fi
-	;;
-    remove)
-	if [ -f /etc/texmf/fmt.d/25latex209.cnf ] ; then
-	    mv -f /etc/texmf/fmt.d/25latex209.cnf /etc/texmf/fmt.d/25latex209.bak
-	fi
-	if [ -x /usr/sbin/update-fmtutil ]; then
-            update-fmtutil
-        fi
-	;;
-    upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
-        ;;
-    *)
-        echo "postrm called with unknown argument \`$1'" >&2
-        exit 0
-	;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
diff -Nru latex209-25.mar.1992/debian/latex209-bin.preinst latex209-25.mar.1992/debian/latex209-bin.preinst
--- latex209-25.mar.1992/debian/latex209-bin.preinst	1970-01-01 09:00:00.000000000 +0900
+++ latex209-25.mar.1992/debian/latex209-bin.preinst	2012-09-20 14:19:43.000000000 +0900
@@ -0,0 +1,63 @@
+#!/bin/sh -e
+#
+# latex209-bin preinst script
+#
+#
+
+# if the config file from previous versions is present and matches the
+# md5sum, add the new dh_installtex header to make sure that no debconf
+# questions are asked, otherwise just let the user decide.
+#
+
+cnffile=/etc/texmf/fmt.d/25latex209.cnf
+bakfile=/etc/texmf/fmt.d/25latex209.bak
+correctmd=7c958ab4f8bf7a0080bc46c48d137bd1
+
+fix_it_up=0
+
+case "$1" in
+  upgrade|install)
+    old_version=$2
+    if [ -n "$old_version" ] && dpkg --compare-versions "$old_version" lt 25.mar.1992-12.6 ; then
+      if [ -r $cnffile ] ; then
+        # if an old conffile is found and matches the md5 sum, we fix it up
+        # otherwise we leave it alone
+	oldmd=`md5sum $cnffile | sed -e 's/ .*//'`
+        if [ "$oldmd" = $correctmd ] ; then
+          fix_it_up=1
+        fi
+      elif [ -r $bakfile ] ; then
+        # if the backup file is found, and matches the md5 sum, we simply delete
+        # it, as it will be reinstatiated by dpkg
+	oldmd=`md5sum $bakfile | sed -e 's/ .*//'`
+        if [ "$oldmd" = $correctmd ] ; then
+          rm $bakfile
+        else
+          mv $bakfile $cnffile
+        fi
+      fi
+      
+      if [ $fix_it_up = 1 ] ; then
+        echo '# 25latex209.cnf
+# You can change/add entries to this file and changes will be preserved
+# over upgrades, even if you have removed the main package prior
+# (not if you purged it). You should leave the following pseudo comment
+# present in the file!
+# -_- DebPkgProvidedMaps -_-
+# 
+#
+# LaTeX 2.09
+#
+# format	engine		pattern-file	arguments
+latex209	tex		-		latex209.ini
+' > $cnffile
+      fi
+    fi
+    ;;
+esac
+
+#DEBHELPER#
+
+exit 0
+
+
diff -Nru latex209-25.mar.1992/debian/latex209-bin.prerm latex209-25.mar.1992/debian/latex209-bin.prerm
--- latex209-25.mar.1992/debian/latex209-bin.prerm	2010-04-06 10:50:48.000000000 +0900
+++ latex209-25.mar.1992/debian/latex209-bin.prerm	1970-01-01 09:00:00.000000000 +0900
@@ -1,39 +0,0 @@
-#!/bin/sh
-# prerm script for latex209-bin
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-#        * <prerm> `remove'
-#        * <old-prerm> `upgrade' <new-version>
-#        * <new-prerm> `failed-upgrade' <old-version>
-#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
-#        * <deconfigured's-prerm> `deconfigure' `in-favour'
-#          <package-being-installed> <version> `removing'
-#          <conflicting-package> <version>
-# for details, see /usr/share/doc/packaging-manual/
-
-case "$1" in
-    remove|upgrade|deconfigure)
-	rm -f /var/lib/texmf/web2c/latex209.fmt
-	rm -f /var/lib/texmf/web2c/latex209.log
-	if [ -x /usr/bin/mktexlsr ]; then
-            mktexlsr
-        fi
-	;;
-    failed-upgrade)
-        ;;
-    *)
-        echo "prerm called with unknown argument \`$1'" >&2
-        exit 0
-	;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
diff -Nru latex209-25.mar.1992/debian/latex209.cnf latex209-25.mar.1992/debian/latex209.cnf
--- latex209-25.mar.1992/debian/latex209.cnf	1970-01-01 09:00:00.000000000 +0900
+++ latex209-25.mar.1992/debian/latex209.cnf	2012-09-20 13:31:19.000000000 +0900
@@ -0,0 +1,6 @@
+#
+# LaTeX 2.09
+#
+# format	engine		pattern-file	arguments
+latex209	tex		-		latex209.ini
+
diff -Nru latex209-25.mar.1992/debian/rules latex209-25.mar.1992/debian/rules
--- latex209-25.mar.1992/debian/rules	2012-05-18 14:45:45.000000000 +0900
+++ latex209-25.mar.1992/debian/rules	2012-09-20 09:26:11.000000000 +0900
@@ -46,6 +46,7 @@
 	mv $(BASE)/splain.tex $(INI)
 	mv $(BASE)/latex.ins $(DOC)
 	cp -p readme.* $(DOC)
+	dh_installtex
 
 install-bin: prefix=$(CURDIR)/debian/latex209-bin/usr
 install-bin: DH_OPTIONS=-platex209-bin
@@ -55,6 +56,8 @@
 	dh_testroot
 	mkdir -p $(BIN)
 	cd $(BIN) && ln -s tex latex209
+	dh_installtex --priority=25 formatfile=debian/latex209.cnf \
+		--flavor=format:no_links
 
 install-src: prefix=$(CURDIR)/debian/latex209-src/usr
 install-src: DH_OPTIONS=-platex209-src

Reply via email to