Author: frn
Date: 2006-02-12 09:40:24 +0000 (Sun, 12 Feb 2006)
New Revision: 501

Modified:
   tex-common/trunk/scripts/postinst-tex
   tex-common/trunk/scripts/postinst-texfonts
   tex-common/trunk/scripts/postrm-tex
   tex-common/trunk/scripts/postrm-texfonts
Log:
Polish the snippets inserted by dh_installtex*:

 * Prefix every function installed by the snippets by dhit_ or dhitf_ to
   make sure it doesn't clash with a function defined by the package
   maintainer in the same maintainer script.

 * updmap should be updmap-sys in some error messages.

 * Use "$@" instead of $* when appropriate and quote parameters when safer.

 * 'echo -n' -> 'printf'


Modified: tex-common/trunk/scripts/postinst-tex
===================================================================
--- tex-common/trunk/scripts/postinst-tex       2006-02-11 17:34:22 UTC (rev 
500)
+++ tex-common/trunk/scripts/postinst-tex       2006-02-12 09:40:24 UTC (rev 
501)
@@ -11,7 +11,7 @@
 # by calling a grep -v '^[ \t]*#'
 # So please be careful if you add stuff here!
 
-update_lsr_files ()
+dhit_update_lsr_files ()
 {
     tempfile=`mktemp -p /tmp mktexlsr.XXXXXXXX`
     printf "Running mktexlsr. This may take some time..."
@@ -28,7 +28,7 @@
     fi
 }
 
-create_fontmaps ()
+dhit_create_fontmaps ()
 {
     tempfile=`mktemp -p /tmp updmap.XXXXXXXX`
     printf "Running updmap-sys. This may take some time..."
@@ -37,7 +37,7 @@
        echo " done."
     else
        echo
-       echo "updmap failed. Output has been stored in"
+       echo "updmap-sys failed. Output has been stored in"
        echo "$tempfile"
        echo "Please include this file if you report a bug."
        echo
@@ -46,7 +46,7 @@
 }
 
 
-build_hyphen_format_if_format_exists ()
+dhit_build_hyphen_format_if_format_exists ()
 {
     v=`kpsewhich -var-value TEXMFSYSVAR`
     c=`kpsewhich -var-value TEXMFSYSCONFIG`
@@ -59,17 +59,17 @@
     # extra check fmtutil does when called with catcfg
     # X=`fmtutil-sys --catcfg | grep "^$1[[:space:]]" || true`
     X=`grep "^[[:space:]]*$1[[:space:]]" $fmtcnffile || true`
-    if [ ! "X$X" = "X" ] ; then
-        build_format --byhyphen $2
+    if [ -n "$X" ] ; then
+        build_format --byhyphen "$2"
     fi
 }
 
-build_format ()
+dhit_build_format ()
 {
 
     tempfile=`mktemp -p /tmp fmtutil.XXXXXXXX`
-    echo -n "Building format(s) $1 `basename "$2"`. This may take some time. 
..."
-    if fmtutil-sys $1 $2 > $tempfile 2>&1 ; then
+    printf "Building format(s) $1 `basename "$2"`. This may take some time..."
+    if fmtutil-sys "$1" "$2" > $tempfile 2>&1 ; then
         rm -f $tempfile
         echo " done."
     else
@@ -89,18 +89,19 @@
         update-updmap --quiet
        update-language
        update-fmtutil
-       update_lsr_files
+       dhit_update_lsr_files
        for i in #WHATTODO# ; do
-               if [ $i = map ] ; then
-                       create_fontmaps
+               if [ "$i" = map ] ; then
+                       dhit_create_fontmaps
                fi
-               if [ $i = format ] ; then
+               if [ "$i" = format ] ; then
                        for fmt in #FORMATS# ; do
-                               build_format --byfmt $fmt
+                               dhit_build_format --byfmt $fmt
                        done
                fi
-               if [ $i = language ] ; then
-                       build_hyphen_format_if_format_exists latex `kpsewhich 
language.dat`
+               if [ "$i" = language ] ; then
+                       dhit_build_hyphen_format_if_format_exists \
+                          latex `kpsewhich language.dat`
                fi
        done
     ;;

Modified: tex-common/trunk/scripts/postinst-texfonts
===================================================================
--- tex-common/trunk/scripts/postinst-texfonts  2006-02-11 17:34:22 UTC (rev 
500)
+++ tex-common/trunk/scripts/postinst-texfonts  2006-02-12 09:40:24 UTC (rev 
501)
@@ -11,7 +11,7 @@
 # by calling a grep -v '^[ \t]*#'
 # So please be careful if you add stuff here!
 
-update_lsr_files ()
+dhitf_update_lsr_files ()
 {
     tempfile=`mktemp -p /tmp mktexlsr.XXXXXXXX`
     printf "Running mktexlsr. This may take some time..."
@@ -28,7 +28,7 @@
     fi
 }
 
-create_fontmaps ()
+dhitf_create_fontmaps ()
 {
     tempfile=`mktemp -p /tmp updmap.XXXXXXXX`
     printf "Running updmap-sys. This may take some time..."
@@ -37,7 +37,7 @@
        echo " done."
     else
        echo
-       echo "updmap failed. Output has been stored in"
+       echo "updmap-sys failed. Output has been stored in"
        echo "$tempfile"
        echo "Please include this file if you report a bug."
        echo
@@ -49,10 +49,10 @@
     configure|abort-upgrade|abort-remove|abort-deconfigure)
         update-updmap --quiet
        if which mktexlsr >/dev/null; then 
-           update_lsr_files
+           dhitf_update_lsr_files
        fi
        if which updmap-sys >/dev/null; then
-           create_fontmaps
+           dhitf_create_fontmaps
        fi
     ;;
 

Modified: tex-common/trunk/scripts/postrm-tex
===================================================================
--- tex-common/trunk/scripts/postrm-tex 2006-02-11 17:34:22 UTC (rev 500)
+++ tex-common/trunk/scripts/postrm-tex 2006-02-12 09:40:24 UTC (rev 501)
@@ -11,13 +11,13 @@
 # by calling a grep -v '^[ \t]*#'
 # So please be careful if you add stuff here!
 
-check_run_without_errors ()
+dhit_check_run_without_errors ()
 {
     tempfile=`mktemp -p /tmp checkrun.XXXXXXXX`
-    if which $1  >/dev/null; then
+    if which "$1"  >/dev/null; then
         printf "Running $*. This may take some time..."
        set +e
-       if $* > $tempfile 2>&1 ; then
+       if "$@" > $tempfile 2>&1 ; then
            rm -f $tempfile
            echo " done."
        else
@@ -25,7 +25,7 @@
            echo "$* failed. Output has been stored in"
            echo "$tempfile"
            echo "If tex-common is not configured you can ignore this error 
message!"
-           echo "Otherwise please include this file if you report a bug."
+           echo "Otherwise, please include this file if you report a bug."
            echo
        fi
        set -e
@@ -35,26 +35,12 @@
     return 0
 }
 
-build_hyphen_format_if_format_exists ()
+dhit_build_format ()
 {
-    v=`kpsewhich -var-value TEXMFSYSVAR`
-    c=`kpsewhich -var-value TEXMFSYSCONFIG`
-    TEXMFVAR="$v"
-    TEXMFCONFIG="$c"
-    export TEXMFVAR TEXMFCONFIG
-    fmtcnffile=`kpsewhich --format='web2c files' fmtutil.cnf`
-    X=`cat $fmtcnffile | grep "^[[:space:]]*$1[[:space:]]" || true`
-    if [ ! "X$X" = "X" ] ; then
-        build_format --byhyphen $2
-    fi
-}
 
-build_format ()
-{
-
     tempfile=`mktemp -p /tmp fmtutil.XXXXXXXX`
-    echo -n "Building format(s) $1 `basename "$2"`. This may take some time. 
..."
-    if fmtutil-sys $1 $2 > $tempfile 2>&1 ; then
+    printf "Building format(s) $1 `basename "$2"`. This may take some time..."
+    if fmtutil-sys "$1" "$2" > $tempfile 2>&1 ; then
         rm -f $tempfile
         echo " done."
     else
@@ -67,27 +53,41 @@
     fi
 }
 
+dhit_build_hyphen_format_if_format_exists ()
+{
+    v=`kpsewhich -var-value TEXMFSYSVAR`
+    c=`kpsewhich -var-value TEXMFSYSCONFIG`
+    TEXMFVAR="$v"
+    TEXMFCONFIG="$c"
+    export TEXMFVAR TEXMFCONFIG
+    fmtcnffile=`kpsewhich --format='web2c files' fmtutil.cnf`
+    X=`cat $fmtcnffile | grep "^[[:space:]]*$1[[:space:]]" || true`
+    if [ -n "$X" ] ; then
+        dhit_build_format --byhyphen "$2"
+    fi
+}
 
 
 case "$1" in
     remove|disappear)
-       # it doesn't hurt to cal all of them
-        check_run_without_errors update-updmap --quiet
-       check_run_without_errors update-language
-       check_run_without_errors update-fmtutil
-       check_run_without_errors mktexlsr
+       # it doesn't hurt to cal all of them
+       dhit_check_run_without_errors update-updmap --quiet
+       dhit_check_run_without_errors update-language
+       dhit_check_run_without_errors update-fmtutil
+       dhit_check_run_without_errors mktexlsr
        for i in #WHATTODO# ; do
-               if [ $i = map ] ; then
-                       check_run_without_errors updmap-sys
+               if [ "$i" = map ] ; then
+                       dhit_check_run_without_errors updmap-sys
                fi
-               if [ $i = format ] ; then
+               if [ "$i" = format ] ; then
                        for fmt in #FORMATS# ; do
                                rm -f /var/lib/texmf/web2c/$fmt.*
                        done
                fi
-               if [ $i = language ] ; then
+               if [ "$i" = language ] ; then
                        if which fmtutil-sys >/dev/null ; then
-                               build_hyphen_format_if_format_exists latex 
`kpsewhich language.dat`
+                               dhit_build_hyphen_format_if_format_exists \
+                                  latex `kpsewhich language.dat`
                        fi
                fi
        done

Modified: tex-common/trunk/scripts/postrm-texfonts
===================================================================
--- tex-common/trunk/scripts/postrm-texfonts    2006-02-11 17:34:22 UTC (rev 
500)
+++ tex-common/trunk/scripts/postrm-texfonts    2006-02-12 09:40:24 UTC (rev 
501)
@@ -20,13 +20,13 @@
 # (cf. Policy � 6.5, step 2, about a conflicting package being removed due
 # to the installation of the package being discussed).
 #
-check_run_without_errors ()
+dhitf_check_run_without_errors ()
 {
     tempfile=`mktemp -p /tmp checkrun.XXXXXXXX`
-    if which $1  >/dev/null; then
+    if which "$1"  >/dev/null; then
         printf "Running $*. This may take some time..."
        set +e
-       if $* > $tempfile 2>&1 ; then
+       if "$@" > $tempfile 2>&1 ; then
            rm -f $tempfile
            echo " done."
        else
@@ -34,7 +34,7 @@
            echo "$* failed. Output has been stored in"
            echo "$tempfile"
            echo "If tex-common is not configured you can ignore this error 
message!"
-           echo "Otherwise please include this file if you report a bug."
+           echo "Otherwise, please include this file if you report a bug."
            echo
        fi
        set -e
@@ -47,9 +47,9 @@
 
 case "$1" in
     remove|disappear)
-        check_run_without_errors update-updmap --quiet
-       check_run_without_errors mktexlsr
-       check_run_without_errors updmap-sys
+       dhitf_check_run_without_errors update-updmap --quiet
+       dhitf_check_run_without_errors mktexlsr
+       dhitf_check_run_without_errors updmap-sys
     ;;
 
     purge|upgrade|failed-upgrade|abort-upgrade|abort-install)
@@ -60,5 +60,3 @@
         exit 1
     ;;
 esac
-
-


_______________________________________________
Pkg-tetex-commits mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/pkg-tetex-commits

Reply via email to