[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#454344: Bug#454324: texlive-base-bin -- Doesn't purge all files after piuparts Install+Upgrade+Purge test



Norbert Preining <preining@logic.at> wrote:

> On Sa, 08 Dez 2007, Frank Küster wrote:
>> Therefore I think we should keep the file when we install texlive, but
>> purge it when it is purged (i.e. in postrm purge).
>
> Can you write some code ... ;-)))

Here it comes. It's had some preliminary testing, then I found some
shell scripting errors (yes, those "" are really needed!) and didn't
have time to test the fixed version. Therefore it's not yet checked in.

Regards, Frank

--- texlive-base/debian/texlive-base.postinst.pre	(Revision 3388)
+++ texlive-base/debian/texlive-base.postinst.pre	(Arbeitskopie)
@@ -12,4 +12,63 @@
     ;;
 esac
 
+# take over changes to entries which were handled by texlive-base-bin
+# in etch (see bugs #454324/454344)
+confd=/etc/texmf/fmt.d
+oldfile=$confd/10texlive-base-bin.cnf
+newfile=$confd/10texlive-base.cnf
+# instead of shipping a copy of the etch conffile, here are the
+# non-comment lines it contained:
+old_texline="tex[[:space:]][[:space:]]*tex[[:space:]][[:space:]]*-[[:space:]][[:space:]]*tex.ini"
+old_pdftexline="pdftex[[:space:]][[:space:]]*pdfetex[[:space:]][[:space:]]*-[[:space:]][[:space:]]*-translate-file=cp227.tcx [*]pdftex.ini"
+old_mfline="mf[[:space:]][[:space:]]*mf[[:space:]][[:space:]]*-[[:space:]][[:space:]]*-translate-file=cp227.tcx [*]mf.ini"
+
+filechanged=0
+if [ -f $oldfile ]; then
+  texline=$(grep ^tex[[:space:]] $oldfile)
+  if ! echo "$texline" | grep -q "$old_texline"; then
+    # texline doesn't match old shipped version, handle change
+    sed -i "s/^tex[[:space:]].*/$texline/" $newfile
+    filechanged=1
+  fi
+  pdftexline=$(grep ^pdftex[[:space:]] $oldfile)
+  if ! echo "$pdftexline" | grep -q "$old_pdftexline"; then
+    # pdftexline doesn't match old shipped version, handle change
+    # replace pdfetex with pdftex
+    pdftexline=$(echo $pdftexline | sed 's/pdfetex/pdftex/')
+    sed -i "s/^pdftex[[:space:]].*/$pdftexline/" $newfile
+    filechanged=1
+  fi
+  mfline=$(grep ^mf[[:space:]] $oldfile)
+  if ! echo "$mfline" | grep -q "$old_mfline"; then
+    # mfline doesn't match old shipped version, handle change
+    sed -i "s/^mf[[:space:]].*/$mfline/" $newfile
+    filechanged=1
+  fi
+  # now care for added formats
+  OLDIFS=$IFS
+  IFS='#' # just rubbish, the shell won't see one.
+  addedlines=$(sed -e '/^#/ d; /^tex[[:space:]]/ d; /^pdftex[[:space:]]/ d; /^mf[[:space:]]/ d;' $oldfile)
+  numberoflines=$(echo $addedlines | wc -w)
+  if [ "$numberoflines" -ne 0 ]; then
+    echo >> $newfile
+    echo "# The following added lines have been transferred from" >> $newfile
+    echo "# $oldfile" >> $newfile
+    echo "#They take precedence over earlier entries" >> $newfile
+    echo $addedlines >> $newfile
+  fi
+
+  # now put a remark into the file and remove it.
+  if [ $filechanged -eq 1 ]; then
+    sed -e "/# -_- DebPkgProvidedMaps -_-/ a \
+# this file has been changed by the postinst script. User-changes from
+# 10texlive-base-bin.cnf have been taken over to the new conffile." $newfile
+  fi
+  rm $oldfile
+fi
+
+
+
+
+
 # texlive-base postinst.pre end


-- 
Frank Küster
Debian Developer (teTeX/TeXLive)



Reply to: