[subversion-commit] SVN tetex commit + diffs: r210 - tex-common/trunk/debian

Norbert Preining preining-guest at costa.debian.org
Fri Oct 7 17:35:19 UTC 2005


Author: preining-guest
Date: 2005-10-07 17:35:18 +0000 (Fri, 07 Oct 2005)
New Revision: 210

Modified:
   tex-common/trunk/debian/changelog
   tex-common/trunk/debian/common.functions.in
   tex-common/trunk/debian/config.in
   tex-common/trunk/debian/postinst.in
   tex-common/trunk/debian/templates
Log:
fixed ls-r files handling


Modified: tex-common/trunk/debian/changelog
===================================================================
--- tex-common/trunk/debian/changelog	2005-10-06 16:48:22 UTC (rev 209)
+++ tex-common/trunk/debian/changelog	2005-10-07 17:35:18 UTC (rev 210)
@@ -1,3 +1,10 @@
+tex-common (0.8.1) UNRELEASED; urgency=low
+
+  * Change ls-R file handling to be useful. Don't use debconf as
+    registry. (Closes: #332264)
+
+ -- Norbert Preining <preining at logic.at>  Fri,  7 Oct 2005 13:32:46 +0200
+
 tex-common (0.8) unstable; urgency=low
 
   * Change hyph_size to 8191 - according to DEK it should be a prime

Modified: tex-common/trunk/debian/common.functions.in
===================================================================
--- tex-common/trunk/debian/common.functions.in	2005-10-06 16:48:22 UTC (rev 209)
+++ tex-common/trunk/debian/common.functions.in	2005-10-07 17:35:18 UTC (rev 210)
@@ -3,7 +3,7 @@
 ## Function definitions - included from file common.functions
 #################################################################
 # Copyright (C) 2004 by Frank Küster <frank at debian.org>.
-# $Id: common.functions.in,v 1.2 2005/06/29 19:40:45 frank Exp $
+# $Id$
 
 # internal variables for common.functions
 MKTMPDIR=/tmp
@@ -193,6 +193,16 @@
   fi
 }
 
+select_lsrfile() {
+    case $1 in
+     main) LSR=$TEXMFSYSVAR/ls-R-TEXMFMAIN ;;
+     var)  LSR=$TEXMFSYSVAR/ls-R ;;
+     cache) LSR=/var/cache/fonts/ls-R ;;
+     *) echo "select_lsr: don't know how to set this: $1" >&2 ;;
+    esac
+    echo $LSR
+}
+
 #################################################################
 ##  End of function definitions from file common.functions
 #################################################################

Modified: tex-common/trunk/debian/config.in
===================================================================
--- tex-common/trunk/debian/config.in	2005-10-06 16:48:22 UTC (rev 209)
+++ tex-common/trunk/debian/config.in	2005-10-07 17:35:18 UTC (rev 210)
@@ -13,28 +13,9 @@
 . <:=${CONFMODULE}:>
 db_version 2.0
 
-#
-# move the answers from tetex-bin to tex-common, if there are no answers
-# in the tex-common db
-maybe_move_answer_and_delete() {
-    ans=$1
-    # did the user already see this question?
-    db_fget tex-common/$ans seen || true
-    if [ "$RET" = false ] ; then
-        # no, so if the user saw the tetex question, move the answer
-	# to the tex-common question and set the seen flag.
-	db_fget tetex-bin/$ans seen || true
-	if [ "$RET" = true ] ; then
-	    db_get tetex-bin/$ans || true
-	    db_set tex-common/$ans "$RET"
-	    db_fset tex-common/$ans seen true
-	    # now unregister the tetex question
-	    db_unregister tetex-bin/$ans || true
-	fi
-    fi
-}
+<:open(FUNCTIONS,'common.functions');@FUNCTIONS=<FUNCTIONS>;close(FUNCTIONS):>//
+<:=@FUNCTIONS:>//
 
-	
 ## do the things we have to do for upgraders from old versions
 # it does not harm to do the checks also when $action is reconfigure.
 
@@ -48,26 +29,74 @@
 fi
 
 
-## do the things we have to do always
-db_input low tex-common/managedlsr || true
-db_go
 # we also unregister the tetex-bin/lsr-perms
 db_unregister tetex-bin/lsr-perms || true
 
-db_get tex-common/managedlsr && SELECTED_LSR="$RET"
-if [ -n "$SELECTED_LSR" ]; then
-    maybe_move_answer_and_delete groupname   
-    maybe_move_answer_and_delete groupperm
-    maybe_move_answer_and_delete userperm
-    db_beginblock
-    db_input low tex-common/groupname || true
-    db_input low tex-common/groupperm || true
-    db_input low tex-common/userperm || true
-    db_endblock
-fi
+# and unregister old tex-common questions, they are not needed anymore
+db_unregister tex-common/groupperm || true
+db_unregister tex-common/userperm || true
 
+
+#
+# first we collect those ls-R files which are group writeable in gwritetrue
+# and those which are not group writeable in gwritefalse
+# furthermore we save the respective group and write permission in
+# ${i}group
+gwritetrue=""
+gwritefalse=""
+for i in var cache main ; do
+    eval ${i}group=""
+    lsr=`select_lsrfile $i`
+    if [ -r $lsr ] ; then
+    	tmp=`ls -l $lsr | awk '{print$4}'`
+	eval ${i}group=$tmp
+	if ls -l $lsr | grep -q ^.....w ; then
+	    gwritetrue="$gwritetrue $i"
+	else
+	    gwritefalse="$gwritefalse $i"
+	fi
+    fi
+done
+#
+# now we save the list of group writeable ls-R files to tex-common/managedlsr
+db_set tex-common/managedlsr $gwritetrue || true
+#
+# and ask the user to check if this selection is ok
+db_input low tex-common/managedlsr || true
 db_go
 
+#
+# get the answer of the users, ie what files should really be group writeable
+db_get tex-common/managedlsr && SELECTED_LSR="$RET" || true
+if [ -n "$SELECTED_LSR" ]; then
+    #
+    # we check wether all the group writeable files belong to the same group
+    # if yes, we suggest this group and ask the groupname question,
+    # otherwise we ignore this and do *not* play around with groups.
+    iscommongroup=-1
+    for i in $SELECTED_LSR ; do
+      eval tmp=${i}group
+      if [ "X$iscommongroup" = "X-1" ] ; then
+	 iscommongroup=$tmp
+      else
+         if [ ! $tmp = $iscommongroup ] ; then
+	    iscommongroup=""
+	 fi
+      fi
+    done
+    db_set tex-common/groupname "$iscommongroup" || true
+    if [ -n $iscommongroup ] ; then
+      #
+      # here we could be more intelligent and check wether the choosen group
+      # actually exist, and if not, reask again!
+      #
+      db_input low tex-common/groupname || true
+      db_go
+    fi
+fi
+#
+# we do not care for user permissions in this setting!
+#
 
 # Local Variables:
 # mode: shell-script

Modified: tex-common/trunk/debian/postinst.in
===================================================================
--- tex-common/trunk/debian/postinst.in	2005-10-06 16:48:22 UTC (rev 209)
+++ tex-common/trunk/debian/postinst.in	2005-10-07 17:35:18 UTC (rev 210)
@@ -65,15 +65,15 @@
 
 #
 # create /usr/local/share/texmf, unless the filesystem is read-only:
-#
-    TEXMFLOCAL=/usr/local/share/texmf
-    if [ ! -e $TEXMFLOCAL ]; then
-      if mkdir $TEXMFLOCAL 2>/dev/null; then
-        chmod 2775 $TEXMFLOCAL 2>/dev/null || true
-	chown root:staff $TEXMFLOCAL 2>/dev/null || true
-	ln -s /var/lib/texmf/ls-R-LOCAL /$TEXMFLOCAL/ls-R
-      fi
-    fi
+# this is against policy, disable
+#    TEXMFLOCAL=/usr/local/share/texmf
+#    if [ ! -e $TEXMFLOCAL ]; then
+#      if mkdir $TEXMFLOCAL 2>/dev/null; then
+#        chmod 2775 $TEXMFLOCAL 2>/dev/null || true
+#	chown root:staff $TEXMFLOCAL 2>/dev/null || true
+#	ln -s /var/lib/texmf/ls-R-LOCAL /$TEXMFLOCAL/ls-R
+#      fi
+#    fi
 
 #
 # remove left over fmt/efmt/log files in /usr/share/texmf/web2c/
@@ -111,42 +111,38 @@
 # set permission of ls-R files
     db_get tex-common/managedlsr || true
     if [ -n "$RET" ] ; then
-      MANAGEDLSR="$RET"
-      echo "Fixing permissions and group of ($MANAGEDLSR) ls-R as specified by debconf ..."
-
-      db_get tex-common/groupperm || true
-      if [ x"$RET" = x"true" ]; then
-        LSRPERMS=66
-      else
-        LSRPERMS=64
-      fi
-      db_get tex-common/userperm || true
-      if [ x"$RET" = x"true" ]; then
-        LSRPERMS="$LSRPERMS"6
-      else
-        LSRPERMS="$LSRPERMS"4
-      fi
+      falsegwritefiles=""
+      truegwritefiles=""
+      for i in var cache main ; do
+          if echo $RET | grep -q $i ; then
+	      truegwritefiles="$truegwritefiles $i"
+	  else
+	      falsegwritefiles="$falsegwritefiles $i"
+	  fi
+      done
+      for i in $truegwritefiles ; do
+          lsr=`select_lsrfile $i`
+	  chmod g+w $lsr
+      done
+      for i in $falsegwritefiles ; do
+          lsr=`select_lsrfile $i`
+	  chmod g-w $lsr
+      done
       db_get tex-common/groupname || true
       LSRGROUP="$RET"
-      # work through the list, stolen from locales.postinst
-      list=`echo $MANAGEDLSR | sed -e 's/, /,/g'`
-      save_IFS=$IFS
-      IFS=,
-      for lsr in $list; do
-        case $lsr in 
-	  main) LSR=$TEXMFSYSVAR/ls-R-TEXMFMAIN ;;
-	  var)  LSR=$TEXMFSYSVAR/ls-R ;;
-	  local) LSR=$TEXMFSYSVAR/ls-R-LOCAL ;;
-	  cache) LSR=/var/cache/fonts/ls-R ;;
-	  *) echo "This should not happen: Don't know how to set this! $lsr" ;;
-	esac
-        chmod -v $LSRPERMS $LSR 2>/dev/null | fgrep changed || true
-	chgrp -v $LSRGROUP $LSR 2>/dev/null | fgrep changed || true
-      done
-      IFS=$save_IFS
+      if [ -n $LSRGROUP ] ; then
+        for i in $truegwritefiles ; do
+	    lsr=`select_lsrfile $i`
+	    chgrp -v $LSRGROUP $lsr || true
+	done
+      fi
     else
-      echo "Fixing permissions of ls-R files ..."
-      chmod -v 644 $LSRS 2>/dev/null | fgrep changed || true
+      #
+      # In this case when no ls-R files are managed by debconf
+      # we do nothing. The files get the correct permissions on new
+      # installation, because we ship them like this. And if a user
+      # changes some of the parameters, he is responsible for himself.
+      echo "Leaving permissions of ls-R files as they are ..."
     fi
     ;;
   *)

Modified: tex-common/trunk/debian/templates
===================================================================
--- tex-common/trunk/debian/templates	2005-10-06 16:48:22 UTC (rev 209)
+++ tex-common/trunk/debian/templates	2005-10-07 17:35:18 UTC (rev 210)
@@ -1,59 +1,39 @@
 Template: tex-common/managedlsr
 Type: multiselect
-Choices: main, cache, local, var
-Default: cache, local
-_Description: Select the ls-R file which should be managed by debconf
+Choices: main, cache, var
+Default: cache
+_Description: Select the ls-R file which should be writable by their
+ respective group.
  There are many files installed in a typical TeX system. To speed up the
  search of these files a list of available files is stored in a file called
  ls-R. There are four different locations for TeX files on a Debian system:
   - main: usually /usr/share/texmf, contains only files installed
     by debian packages.
-  - local: usually /usr/local/share/texmf, contains local additions
   - var: usually /var/lib/texmf, contains generated files from the
     TeX system like format files.
   - cache: usually /var/cache/fonts, contains generated fonts.
- You can select from these four locations those whose ls-R file should be
- managed by debconf.
+ You can select from these three locations those whose ls-R files should
+ be group writable. Those ls-R which have not been selected will be removed
+ the group write permission.
  .
- We suggest selecting cache and local (these are the defaults) and allowing
+ We suggest selecting cache (this is the defaults) and allowing
  a selected user group to modify these ls-R files out of the following
  reasons:
  .
  A lot of font files have to be generated before they can be used by xdvi,
  dvips etc. These files are stored in /var/cache/fonts, so that they do not
  need to be regenerated every time.
- .
- Some users may have the right to add files to the local texmf tree, so
- they should also be allowed to change the ls-R file.
- .
- Accepting this option will allow you to easily manage the permissions of
- those ls-R files using debconf. Otherwise you will have to manually ensure
- that they get useful but safe permissions.
 
 Template: tex-common/groupname
 Type: string
 Default: users
 _Description: Which group should own the ls-R files?
- Modification of ls-R files can be restricted to the members of one group
- which owns them.  To take advantage of this, add the users to the group of
- your choice, and enter that group name here.  The default group, 'users',
- is appropriate for most systems.
+ You can choose a specific group which the previously selected ls-R files
+ should belong to. If you do not enter a group name here, the group
+ ownership of the selected files will not be touched at all. If you
+ have selected 'cache' in the previous question, we would suggest to select
+ the group 'users' here.
 
-Template: tex-common/groupperm
-Type: boolean
-Default: true
-_Description: Allow group members to modify ls-R files?
- Accepting this option will allow members of the owning group to modify the
- ls-R files.
-
-Template: tex-common/userperm
-Type: boolean
-Default: false
-_Description: Allow all users to modify ls-R files?
- Accepting this option will allow all users to modify ls-R files.  This is
- generally not a good idea for security reasons; you should instead
- restrict such access to members of one group.
-
 Template: tex-common/cnf_name
 Type: note
 _Description: Change of name of files in /etc/texmf/texmf.d/




More information about the Pkg-tetex-commits mailing list