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

Frank Küster frank at costa.debian.org
Tue May 9 15:16:02 UTC 2006


Author: frank
Date: 2006-05-09 15:16:01 +0000 (Tue, 09 May 2006)
New Revision: 1315

Modified:
   tex-common/trunk/debian/config.in
Log:
- make config run cleanly before unpacking (when apt-utils is
  installed) by OR'ing the stat calls with true

- use getent instead of parsing /etc/{passwd,group}: This should work
  also on LPAP'ed multiuser systems which happen to have a single user
  in /etc/passwd

- replace geeky sed code with readable egrep | cut invocations



Modified: tex-common/trunk/debian/config.in
===================================================================
--- tex-common/trunk/debian/config.in	2006-05-09 14:35:49 UTC (rev 1314)
+++ tex-common/trunk/debian/config.in	2006-05-09 15:16:01 UTC (rev 1315)
@@ -56,11 +56,11 @@
 
   # check wether the directory /var/cache/fonts is group writeable and
   # for which group
-  PERMS=$(stat --format="%a" /var/cache/fonts 2>/dev/null)
-  GROUP=$(stat --format="%G" /var/cache/fonts 2>/dev/null)
+  PERMS=$(stat --format="%a" /var/cache/fonts 2>/dev/null) || true
+  GROUP=$(stat --format="%G" /var/cache/fonts 2>/dev/null) || true
 
   if [ "$GROUP" = "UNKNOWN" ] ; then
-    GROUP=$(stat --format="%g" /var/cache/fonts 2>/dev/null)
+    GROUP=$(stat --format="%g" /var/cache/fonts 2>/dev/null) || true
   fi
 
   # see wether we already have asked this question once
@@ -98,7 +98,7 @@
   # now check whether this machine has only one normal user account (outside the system range)
   usercount=0
   userid=""
-  for uid in `cut -d ':' -f 3 /etc/passwd`; do
+  for uid in `getent passwd | cut -d ':' -f 3`; do
     if [ $uid -ge 1000 ] && [ $uid -le 29999 ]; then
       userid=$uid
       : $((usercount++))
@@ -107,14 +107,8 @@
   if [ $usercount -eq 1 ]; then
     db_set tex-common/singleuser true
     # exactly one user account, number in $userid: suggest its group
-    # this might break with other authentication setups than /etc/passwd,
-    # but it's only a suggestion
-    groupID=`sed -n -e "/^[^:]\{1,\}:[^:]\{1,\}:$userid:/ \
-        { s@^[^:]\{1,\}:[^:]\{1,\}:$userid:\([[:digit:]]\{1,\}\):.*@\1@; p }" \
-	/etc/passwd`
-    GROUP=`sed -n -e "/^[^:]\{1,\}:[^:]\{1,\}:$userid/ \
-        {s@^\([^:]\{1,\}\):[^:]\{1,\}:$userid:.*@\1@; p}" \
-        /etc/group`
+    groupID=`getent passwd | egrep "^[^:]+:[^:]+:$userid:" | cut -d ':' -f 4`
+    GROUP=`getent group | egrep "^[^:]+:[^:]+:$groupID:" | cut -d ':' -f 1`
     db_set tex-common/groupname_single "$GROUP" || true
   fi
 




More information about the Pkg-tetex-commits mailing list