vdr/vdr/debian order.conf changelog rules vdr.default vdr.init

Tobias Grimm pkg-vdr-dvb-changes@lists.alioth.debian.org
Sat, 24 Apr 2004 15:47:05 +0000


Update of /cvsroot/pkg-vdr-dvb/vdr/vdr/debian
In directory haydn:/tmp/cvs-serv22339

Modified Files:
	changelog rules vdr.default vdr.init 
Added Files:
	order.conf 
Log Message:
added modifications for automatic plugin loading

Index: changelog
===================================================================
RCS file: /cvsroot/pkg-vdr-dvb/vdr/vdr/debian/changelog,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- changelog	24 Apr 2004 15:36:26 -0000	1.5
+++ changelog	24 Apr 2004 15:47:03 -0000	1.6
@@ -8,6 +8,8 @@
     - Change architecture of package vdr to all - it does not 
       contain any architecture-dependent files anymore
     - Cleaned up some parts to avoid lintian warnings and errors
+  * Tobias Grimm <vdr@e-tobi.net>
+    - added automatic loading of plugins in init script from c't vdr
 
  -- Thomas Schmidt <thomas.schmidt@in.stud.tu-ilmenau.de>  Sat, 24 Apr 2004 12:04:41 +0200
 

Index: vdr.default
===================================================================
RCS file: /cvsroot/pkg-vdr-dvb/vdr/vdr/debian/vdr.default,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- vdr.default	21 Apr 2004 14:19:07 -0000	1.1.1.1
+++ vdr.default	24 Apr 2004 15:47:03 -0000	1.2
@@ -16,8 +16,17 @@
 # Config-Directory
 CFG_DIR="/etc/vdr"
 
-# Plugins to load
-PLUGINS="-Pstatus"
+# Plugin-Directory
+PLUGIN_DIR="/usr/lib/vdr/plugins"
+
+# Plugin Config-Directory
+PLUGIN_CFG_DIR="$CFG_DIR/plugins"
+
+# Plugin prefix
+PLUGIN_PREFIX="libvdr-"
+
+# Plugin order configuration
+PLUGIN_ORDER_FILE="$PLUGIN_CFG_DIR/order.conf"
 
 # Options that will be passed to vdr's commandline
 # for example: OPTIONS="-w 15 --port=0"

Index: vdr.init
===================================================================
RCS file: /cvsroot/pkg-vdr-dvb/vdr/vdr/debian/vdr.init,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- vdr.init	24 Apr 2004 14:20:12 -0000	1.2
+++ vdr.init	24 Apr 2004 15:47:03 -0000	1.3
@@ -6,6 +6,7 @@
 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 NAME=vdr
 DESC="vdr - Linux Video Disk Recorder"
+VDRPRG=/usr/bin/vdr
 
 
 # Defaults - don't touch, edit /etc/default/vdr
@@ -18,6 +19,8 @@
 
 test -x /usr/sbin/runvdr || exit 0
 
+VERSION=`$VDRPRG -V 2>/dev/null | sed -e 's/.*(\(.*\)).*/\1/'`
+
 startvdr() 
 {
     start-stop-daemon --start --quiet \
@@ -32,9 +35,51 @@
     killall -q -TERM $DAEMON
 }
 
+getplugins ()
+{
+    local plugin_order
+    local installed_plugins
+    local ordered_plugins
+    local plugin
+    local i
+    local arguments
+
+    echo -n "Seeking plugins: "
+
+    # generate data structures
+    plugin_order=( `cat $PLUGIN_ORDER_FILE | sed "s/#.*$//"` )
+    installed_plugins=( `find $PLUGIN_DIR -maxdepth 1 -name "$PLUGIN_PREFIX*.so.$VERSION" -printf "%f " | sed "s/$PLUGIN_PREFIX\([^\.]\+\)\.so\.$VERSION/\1/g"` )
+
+    # generate list of plugins with a fixed order:
+    for plugin in ${plugin_order[@]}; do
+        for (( i=0 ; i<${#installed_plugins[@]} ; i++ )); do
+            if [ "$plugin" == "${inctalled_plugins[$i]}" ]; then
+                ordered_plugins=( "${ordered_plugins[@]}" "$plugin" )
+                unset plugins[$i]
+		installed_plugins=( "${installed_plugins[@]}" )
+		break
+            fi
+        done
+    done
+    # then the remaining unordered plugins
+    ordered_plugins=( "${ordered_plugins[@]}" "${plugins[@]}" )
+
+    # add the command line arguments
+    for plugin in ${ordered_plugins[@]}; do
+        echo -n "$plugin "
+        PLUGINS="$PLUGINS -P $plugin"
+        if [ -r "$PLUGIN_CFG_DIR/plugin.$plugin.conf" ] ; then
+            arguments=( `cat $PLUGIN_CFG_DIR/plugin.$plugin.conf | sed "s/#.*$//"` )
+            PLUGINS="$PLUGINS ${arguments[*]}\""
+        fi
+    done
+    echo
+}
+
 case "$1" in
   start)
 	 echo -n "Starting $DESC: $NAME"
+    	 getplugins
 	 startvdr
 	 echo "."
 	 ;;

--- NEW FILE: order.conf ---
#
# If you like a fixed plugin order in your menu place the plugin base names
# here. Remember that the first entry a plugin may get starts at five in 
# VDR's OSD.
#

firstplugin
secondplugin
thirdplugin

Index: rules
===================================================================
RCS file: /cvsroot/pkg-vdr-dvb/vdr/vdr/debian/rules,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- rules	24 Apr 2004 15:28:54 -0000	1.5
+++ rules	24 Apr 2004 15:47:03 -0000	1.6
@@ -101,7 +101,10 @@
 	# install modified runvdr script
 	cp $(CURDIR)/debian/runvdr $(CURDIR)/debian/vdr/usr/sbin/runvdr
 	chmod ugo+x $(CURDIR)/debian/vdr/usr/sbin/runvdr
-	
+
+	# install additional conf-files
+	cp debian/order.conf $(CURDIR)/debian/vdr/etc/vdr/plugins
+
 	# plugins
 	for x in hello osddemo status; do \
 		cp -a PLUGINS/lib/libvdr-$$x.so.* $(CURDIR)/debian/vdr-plugin-examples/usr/lib/vdr/plugins; \