r4522 - vdr/vdr/trunk/debian

Thomas Schmidt tschmidt at alioth.debian.org
Tue May 1 12:22:23 UTC 2007


Author: tschmidt
Date: 2007-05-01 12:22:23 +0000 (Tue, 01 May 2007)
New Revision: 4522

Added:
   vdr/vdr/trunk/debian/vdr.groups
Removed:
   vdr/vdr/trunk/debian/vdr-groups.conf
Modified:
   vdr/vdr/trunk/debian/README.Debian
   vdr/vdr/trunk/debian/changelog
   vdr/vdr/trunk/debian/vdr-groups.sh
   vdr/vdr/trunk/debian/vdr.install
Log:
* Added vdr-groups.sh script which can be used by plugins which require the
  user vdr to be a member in additional system groups, see README.Debian 
  for additional information

Modified: vdr/vdr/trunk/debian/README.Debian
===================================================================
--- vdr/vdr/trunk/debian/README.Debian	2007-04-28 08:12:47 UTC (rev 4521)
+++ vdr/vdr/trunk/debian/README.Debian	2007-05-01 12:22:23 UTC (rev 4522)
@@ -230,7 +230,22 @@
 
 SHUTDOWNCMD=<new shutdown command>
 
+Group memberships
+-----------------
 
+A few plugins require that the user vdr is member in additional system groups 
+like audio or cdrom. To be a little bit more flexible, we have designed a 
+mechanism which can be used by plugins to specify additional group memberships.
+Plugins can add a file /etc/vdr/groups.d/<plugin-name> and call 
+/usr/lib/vdr/vdr-groups.sh in postinst, this will automatically check if vdr is 
+member in all groups which are listed in the files unter /etc/vdr/groups.sh,
+if vdr is not member of one of these groups, it will be added to the specific 
+groups. If the plugin is uninstalled, it should call /usr/lib/vdr/vdr-groups.sh
+again in postrm, as this script will remove vdr from unnecessary groups again.
+
+ -- Thomas Schmidt <tschmidt at debian.org>,  Tue, 01 May 2007 14:12:15 +0200
+
+
 Optional Patches
 ----------------
 

Modified: vdr/vdr/trunk/debian/changelog
===================================================================
--- vdr/vdr/trunk/debian/changelog	2007-04-28 08:12:47 UTC (rev 4521)
+++ vdr/vdr/trunk/debian/changelog	2007-05-01 12:22:23 UTC (rev 4522)
@@ -16,8 +16,13 @@
   [ Thomas Günther ]
   * Removed debug logs in 17_epg-conv-iso6937.dpatch
 
- -- Thomas Günther <tom at toms-cafe.de>  Wed, 14 Mar 2007 01:30:07 +0100
+  [ Thomas Schmidt ]
+  * Added vdr-groups.sh script which can be used by plugins which require the
+    user vdr to be a member in additional system groups, see README.Debian 
+    for additional information
 
+ -- Thomas Schmidt <tschmidt at debian.org>  Tue,  1 May 2007 13:50:39 +0200
+
 vdr (1.4.6-1) experimental; urgency=low
 
   [ Tobias Grimm ]

Deleted: vdr/vdr/trunk/debian/vdr-groups.conf
===================================================================
--- vdr/vdr/trunk/debian/vdr-groups.conf	2007-04-28 08:12:47 UTC (rev 4521)
+++ vdr/vdr/trunk/debian/vdr-groups.conf	2007-05-01 12:22:23 UTC (rev 4522)
@@ -1,11 +0,0 @@
-#
-# If you require VDR to run as a member of a specific group and added
-# the user 'vdr' manually to this group, you should add the group name
-# to this file. The installation / deinstallation procedure of plugin
-# packages will automatically modify and check this file to keep track
-# of vdr group memberships.
-# 
-
-vdr    # by default vdr is assigned to group 'vdr', you shouldn't change this
-video  # by default vdr is assigned to group 'video', you shouldn't change this
-

Modified: vdr/vdr/trunk/debian/vdr-groups.sh
===================================================================
--- vdr/vdr/trunk/debian/vdr-groups.sh	2007-04-28 08:12:47 UTC (rev 4521)
+++ vdr/vdr/trunk/debian/vdr-groups.sh	2007-05-01 12:22:23 UTC (rev 4522)
@@ -1,27 +1,48 @@
+#!/bin/sh
 #
-# vdr-groups.sh  
-# 
-# Shell script to be used by vdr plugin packages  to register/deregister
-# required vdr group memberships.
+# This script checks which groups the vdr user should belong to and adds
+# it to the necessary groups or removes it from groups which are not needed
+# anymore
 #
-# Usage:
+# (c) 2007, Thomas Schmidt <tschmidt at debian.org>
 #
-# /bin/sh /usr/share/vdr/vdr-groups.sh --add <GROUP> <PLUGIN-NAME>
-# /bin/sh /usr/share/vdr/vdr-groups.sh --remove <GROUP> <PLUGIN-NAME>
-#
 
-VDRGROUPS=/etc/vdr/vdr-groups.sh
+DIR="/etc/vdr/groups.d"
+VDR_USER=vdr
 
-add_to_group()
-{
-   # 1. Add vdr to <GROUP>
-   # 2. Add entry to vdr-groups.conf: 
-   #    <GROUP>    # <PLUGIN-NAME> (don't touch this - will be maintained by the plugin)
-}
+NEEDED_GROUPS=`cat $DIR/* | grep -v "^#\|^$" | sed s/"\(.*\)#.*"/"\1"/ | xargs`
+ACTUAL_GROUPS=`groups $VDR_USER | cut -d' ' -f3-`
 
-remove_from_group()
-{
-   # 1. Remove mathching <GROUP> entry from vdr-groups.conf
-   # 2. If no <GROUP> entry is left, remove user vdr from <GROUP>
-}
+# add $VDR_USER to the required groups
+for NEEDED_GROUP in $NEEDED_GROUPS; do
+   REQUIRED=1
 
+   for ACTUAL_GROUP in $ACTUAL_GROUPS; do
+      if [ $NEEDED_GROUP = $ACTUAL_GROUP ]; then
+         REQUIRED=0
+      fi
+   done
+
+   if [ $REQUIRED = "1" ]; then
+      # add $VDR_USER to $NEEDED_GROUP
+      echo "Adding $VDR_USER to group $NEEDED_GROUP"
+      #adduser $VDR_USER $NEEDED_GROUP > /dev/null 2>&1
+   fi
+done
+
+# check if $VDR_USER is member of any unnecessary groups
+for ACTUAL_GROUP in $ACTUAL_GROUPS; do
+   REQUIRED=0
+
+   for NEEDED_GROUP in $NEEDED_GROUPS; do
+      if [ $ACTUAL_GROUP = $NEEDED_GROUP ]; then
+         REQUIRED=1
+      fi
+   done
+
+   if [ $REQUIRED = "0" ]; then
+      # remove $VDR_USER from $ACTUAL_GROUP
+      echo "Removing $VDR_USER from group $ACTUAL_GROUP"
+      #deluser $VDR_USER $ACTUAL_GROUP > /dev/null 2>&1
+   fi
+done

Added: vdr/vdr/trunk/debian/vdr.groups
===================================================================
--- vdr/vdr/trunk/debian/vdr.groups	2007-04-28 08:12:47 UTC (rev 4521)
+++ vdr/vdr/trunk/debian/vdr.groups	2007-05-01 12:22:23 UTC (rev 4522)
@@ -0,0 +1,4 @@
+# vdr should be in the groups vdr, video and cdrom
+vdr
+video
+cdrom

Modified: vdr/vdr/trunk/debian/vdr.install
===================================================================
--- vdr/vdr/trunk/debian/vdr.install	2007-04-28 08:12:47 UTC (rev 4521)
+++ vdr/vdr/trunk/debian/vdr.install	2007-05-01 12:22:23 UTC (rev 4522)
@@ -20,6 +20,7 @@
 debian/config-loader.sh   usr/lib/vdr
 debian/plugin-loader.sh   usr/lib/vdr
 debian/commands-loader.sh usr/lib/vdr
+debian/vdr-groups.sh      usr/lib/vdr
 
 diseqc.conf     etc/vdr/
 keymacros.conf  etc/vdr/




More information about the pkg-vdr-dvb-changes mailing list