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

Re: new lmodern package

Hi all!

On Mit, 08 Feb 2006, Norbert Preining wrote:
> What about the following idea:
> a) /etc/texmf/updmap.d/10lmodern.cfg exists
>   - if the file was unchanged, remove it
>   - if the file is changed, only add a magic header
> b) /etc/texmf/updmap.d/10lmodern.cfg does not exist
>   - the SAVED_CONFIG_FILE exists, ie if the 
>      old lmodern was removed but not purged:
> 	- if SAVED_CONFIG_FILE is the same as the original CONFIG_FILE
> 	  remove it
> 	- if SAVED_CONFIG_FILE was changed
> 	  move it to the right /etc/texmf/updmap.d/ location, and
> 	  add a magic header
>   - also SAVED_CONFIG_FILE is missing
>     (the user has deleted the updmap.d config file)
>     create the same updmap.d config file as in the new package, but
>     with all Map items commented out

I implemented this idea, although the flow is a bit different.
Here is the addition to lmodern.preinst:

Index: lmodern.preinst
--- lmodern.preinst	(Revision 316)
+++ lmodern.preinst	(Arbeitskopie)
@@ -61,6 +61,29 @@
     # The directory should be empty by now.
     [ -d "$OLD_STATE_DIR" ] && rmdir "$OLD_STATE_DIR"
+    # if the CONFIG_FILE is unchanged, remove it
+    if [ -f "$CONFIG_FILE" ] ; then
+	cnfmdsum=`md5sum "$CONFIG_FILE" | cut -d ' ' -f 1`
+	if [ "$cnfmdsum" = "MISSING MD5 SUM HERE" ] ; then
+	    # we can remove the file as it hasn't been changed
+	    rm -f "$CONFIG_FILE"
+	else
+	    # the file was changed
+	    # if it does not contain a magic header, we add it
+	    if grep -q '^# -_- DebPkgProvidedMaps -_-' "$CONFIG_FILE" ; then
+	        : do nothing
+	    else
+	        cat > "$TEMP_CONFIG_FILE" <<EndOfEmptyConfigFile
+# Don't delete the following pseudo-comment unless you know what you are doing.
+# -_- DebPkgProvidedMaps -_-
+# This file will *not* be included in updmap.cfg if the lmodern package is
+# removed. Please read update-updmap(1) for details.
+	    fi
+	fi
+    fi
     return 0

Here 2 points are importatnt:
- The old md5sum is missing, as it is not a config file, I cannot grep
  in /v/l/d/status
- in case the admin deliberately removed the config file, we do NOT
  create the current 10lmodern.cfg file with Maps uncommented, but 
  just a very simple. I think this is ok, the admin should now when
  he has deleted the config file.

Best wishes


Dr. Norbert Preining <preining AT logic DOT at>             Università di Siena
gpg DSA: 0x09C5B094      fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094
SCREGGAN (n. banking)
The crossed-out bit caused by people putting the wrong year on their
cheques all through January.
			--- Douglas Adams, The Meaning of Liff

Reply to: