Frank Küster <[EMAIL PROTECTED]> wrote:

> Norbert Preining <[EMAIL PROTECTED]> wrote:
>>
>> Nothing that comes to my mind immediately. Only how to choose the group?
>> Ship it as root.root, do we change the ownership of the directories on
>> dpkg-reconfigure tex-common?
>
> That sounds sensible.  We would use dpkg-statoverride, but would have to
> seed debconf by querying dpkg-statoverride's database.  Or something
> like that.

What about the following patch?

Index: config.in
===================================================================
--- config.in   (Revision 501)
+++ config.in   (Arbeitskopie)
@@ -110,6 +110,14 @@
         fi
       fi
     done
+    # for future comparison, we save away whether there was an old debconf
+    # managed name
+    OLD_DEBCONF_GROUP=""
+    db_get tex-common/groupname || true
+    test -n "$RET" && OLD_DEBCONF_GROUP="$RET" || true
+    # We also test and save which group /var/cache/fonts/ls-R currently 
belongs to
+    OLD_SYSTEM_GROUP="$(ls -l /var/cache/fonts/ls-R | cut -d ' ' -f 5)"
+
     # $iscommongroup will be empty only if there were 2 or 3 group-writable
     # ls-R files belonging to different groups.
     db_set tex-common/groupname "$iscommongroup" || true
@@ -122,6 +130,50 @@
       #
     db_input low tex-common/groupname || true
     db_go
+    
+    # Now we have to check whether we should ask the question about changing
+    # group ownership of /var/cache/fonts.
+    if echo "$SELECTED_LSR" | grep -q cache; then
+      # we do handle the ls-R file for that tree.  Is there a common groupname?
+      db_get  tex-common/groupname || true
+      if [ -n "$RET" ]; then
+       CACHE_GROUP="$RET"
+       if [ -z "$OLD_DEBCONF_GROUP" ] && [ "$OLD_SYSTEM_GROUP" = "root" ]; then
+         # install default
+         HANDLE_GROUP=true
+       elif [ -n "$OLD_DEBCONF_GROUP" ] && [ "$OLD_SYSTEM_GROUP" = 
"$OLD_DEBCONF_GROUP" ]; then
+         if [ "$OLD_DEBCONF_GROUP" = "$CACHE_GROUP" ];
+           # nothing changed
+           HANDLE_GROUP=false
+         else
+           # the user changes from one consistent setting to an other, via 
debconf
+           HANDLE_GROUP=true
+         fi
+       else
+         # the old debconf setting and the actual system setting are different.
+         # we don't touch anything.  Either the directories already belong to 
the 
+         # newly selected group, or debconf and real information differ, and 
we 
+         # won't spoil manual changes.
+         HANDLE_GROUP=false
+       fi  
+      else
+       # no group chosen, no action
+       :
+      fi
+    else
+      # font cache not managed, no action
+      :
+    fi
+    if [ "$HANDLE_GROUP" = true ]; then
+      db_subst  tex-common/cachegroup cachegroup ${CACHE_GROUP} || true
+      db_input low tex-common/cachegroup ||true
+      db_go 
+    else
+      db-set tex-common/cachegroup false || true 
+    fi
+  else
+    # no common group chosen
+    :
   fi
 fi
 fi


-- 
Frank Küster
Single Molecule Spectroscopy, Protein Folding @ Inst. f. Biochemie, Univ. Zürich
Debian Developer (teTeX)


Reply via email to