summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUdo Richter <udo_richter@gmx.de>2008-03-02 00:00:00 +0100
committerManuel Reimer <manuel.reimer@gmx.de>2013-10-01 17:18:45 +0200
commit207697bc97e1ac8905c14baac311769e02834330 (patch)
tree458ffeb0ecb1da1ff2a9afd446ca200449498453
parent6d08550184e9d6d801d67882a827da46fadcdb66 (diff)
downloadrunvdr-extreme-207697bc97e1ac8905c14baac311769e02834330.tar.gz
runvdr-extreme-207697bc97e1ac8905c14baac311769e02834330.tar.bz2
Version 0.3.0v0.3.0
* New: Support for the new VDR parameters --localedir and --userdump (LOCALEDIR="..." and USERDUMP="1") * New: Wildcard loading with INCLUDE, allows for example to INCLUDE /etc/runvdr/conf.d/* to load several one-file-per-plugin config files. * New: runvdr-conf.d, a plugin enable/disable service * New: osdserver frontend for runvdr-conf.d * New: Sample init.d script, Debian style * Fix: Clean up mess with USER= and VDRUSER=. VDRUSER still works, but is deprecated.
-rw-r--r--HISTORY12
-rw-r--r--README63
-rw-r--r--README.de65
-rwxr-xr-xinit.d.runvdr.Debian83
-rwxr-xr-xrunvdr158
-rwxr-xr-xrunvdr-conf.d425
-rw-r--r--runvdr.conf.example17
-rw-r--r--skeleton.example7
8 files changed, 759 insertions, 71 deletions
diff --git a/HISTORY b/HISTORY
index b414bbf..d7be5fa 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1,6 +1,18 @@
runvdr extreme Revision History
-------------------------------
+
+2008-03-02: Version 0.3.0
+- New: Support for the new VDR parameters --localedir and --userdump
+ (LOCALEDIR="..." and USERDUMP="1")
+- New: Wildcard loading with INCLUDE, allows for example to INCLUDE
+ /etc/runvdr/conf.d/* to load several one-file-per-plugin config files.
+- New: runvdr-conf.d, a plugin enable/disable service
+- New: osdserver frontend for runvdr-conf.d
+- New: Sample init.d script, Debian style
+- Fix: Clean up mess with USER= and VDRUSER=. VDRUSER still works,
+ but is deprecated.
+
2007-02-18: Version 0.2.0
- New: Pass DVBLOAD and DVBUNLOAD to eval, allows to execute more than one
diff --git a/README b/README
index a1c9490..2a8ebf7 100644
--- a/README
+++ b/README
@@ -32,6 +32,14 @@ Some of the features of runvdr extreme:
- Can set locale for VDR daemon
- Optionally supports pluginsetup-plugin
+Additional features of runvdr-conf.d:
+
+- Loads configuration files in alphabetical order from a
+ directory, comparable to init.d directories.
+- Command line tool to activate/deactivate plugins
+- Control the load order of plugins
+- Optional: Menu configuration using osdserver plugin
+
Quick-start
@@ -44,6 +52,17 @@ Quick-start
The runvdr.conf is pretty much self-explaining. All runvdr.conf options are
also available on command line, see --help.
+For the init-script (Debian):
+- Copy init.d.runvdr.Debian to /etc/init.d/runvdr
+- Use update-rc.d to set up startup runlevel
+
+For runvdr-conf.d:
+- Copy runvdr-conf.d to /usr/local/bin/
+- Create /etc/runvdr/ and fill it with files like skeleton.example
+- Add INCLUDE /etc/runvdr/conf.d/* to runvdr.conf
+- Use runvdr-conf.d show|enable|disable to configure the plugins
+- (Optional) Add "runvdr-conf.d osdserver" to commands.conf.
+
Details
@@ -63,6 +82,11 @@ file from a runvdr.conf by using the INCLUDE directive. For example, you can
load /etc/runvdr.conf from within ~/.runvdr.conf to just override some of
the settings for the current user.
+The INCLUDE directive also supports multiple files per line. By that, you can
+use INCLUDE /etc/runvdr/conf.d/* to load a whole directory full of config
+files at once. For example, you can put files (or symlinks) for each plugin
+to load into that directory, containing a single line "AddPlugin xxx".
+
Plugins added by the AddPlugin directive in the conf file and the --plugin
and -P command line option can be removed again from the list of plugins
by specifying "AddPlugin -name", --plugin="-name" or -P-name.
@@ -77,6 +101,45 @@ All parameters after -- will be directly passed to VDR. For erxample,
+runvdr-conf.d
+--------------------------------------------------------------------------
+
+The runvdr-conf.d is an (optional) tool to manage plugins. It works simillar
+to the init.d concept, where a whole directory of symbolic links is loaded
+in alphabetical order.
+
+In case of runvdr-conf.d, one file similar to the skeleton.example file
+is placed in /etc/runvdr/ for each plugin that is available. Only plugins
+that have a symbolic link in /etc/runvdr/conf.d/ to their config file will
+be loaded. For this, the corresponding INCLUDE line must be enabled in
+runvdr.conf.
+
+The following commands are available to manage the plugins:
+
+runvdr-conf.d show [name]
+ Shows all plugins (resp. only the 'name' plugin), including the full name
+ and the load priority. 'name' is the file name in the /etc/runvdr/
+ directory.
+
+runvdr-conf.d enable name [--prio XX]
+ Activates a plugin for next restart. Uses default priority or the specified
+ priority. For that, a symbolic link to /etc/runvdr/name will be created
+ under /etc/runvdr/conf.d/XXname.
+
+runvdr-conf.d disable name
+ Deactivates a plugin from next restart on, by deleting the symbolic link
+ under /etc/runvdr/conf.d/XXname.
+
+runvdr-conf.d osdserver [--debug]
+ Connects to the osdserver plugin and allows interactive plugin configuration
+ using the VDR OSD. From there, plugins can be activated and deactivated,
+ and the load priority can be changed.
+ Without --debug, runvdr-conf.d returns immediately, disconnection standard
+ input/output, so it can be started from commands.conf. With --debug, the
+ osdserver communication will be shown.
+
+
+
Dependencies
--------------------------------------------------------------------------
Unix commands, that runvdr uses:
diff --git a/README.de b/README.de
index 0417102..b936de9 100644
--- a/README.de
+++ b/README.de
@@ -32,6 +32,14 @@ Einige der Features von runvdr extreme:
- Kann Landessprache für VDR setzen
- Unterstützt Pluginsetup-Plugin optional
+Dazu kommt runvdr-conf.d:
+
+- Lädt Konfigurationsdateien alphabetisch aus einem Verzeichnis,
+ vergleichbar mit init.d-Verzeichnissen.
+- Kommandozeilentool zum Aktivieren/Deaktivieren von Plugins
+- Festlegen der Ladereihenfolge
+- Optional: Menüsteuerung per osdserver-Plugin
+
Schnellstart
@@ -45,6 +53,18 @@ Schnellstart
Die runvdr.conf ist größtenteils selbsterklärend. Alle Optionen sind auch
per Kommandozeile verfügbar, siehe runvdr --help.
+Für das init-Skript (Debian):
+- Kopiere init.d.runvdr.Debian nach /etc/init.d/runvdr
+- Benutze update-rc.d um die Start-Runlevel zu konfigurieren.
+
+Für runvdr-conf.d:
+- Kopiere runvdr-conf.d nach /usr/local/bin/
+- /etc/runvdr/ anlegen und mit Dateien nach Vorbild der skeleton.example
+ füllen
+- INCLUDE /etc/runvdr/conf.d/* in runvdr.conf aufnehmen
+- runvdr-conf.d show|enable|disable zum Konfigurieren der Plugins verwenden
+- (Optional) "runvdr-conf.d osdserver" in commands.conf hinzufügen.
+
Details
@@ -65,6 +85,12 @@ runvdr.conf laden, wenn man die INCLUDE-Direktive verwendet. Man kann zum
Beispiel /etc/runvdr.conf aus der Datei ~/.runvdr.conf heraus laden, um
für den aktuellen Benutzer einige Einstellungen zu überschreiben.
+Die INCLUDE-Direktive kann auch mehrere Konfigurationsdateien laden. So kann
+man z.B. mit INCLUDE /etc/runvdr/conf.d/* ein ganzes Verzeichnis von
+Konfigurationsdateien laden. Beispielsweise könnten in so einem Verzeichnis
+für jedes zu ladende Plugin eine Datei (oder Symlink) mit dem Einzeiler
+"AddPlugin xxx" liegen.
+
Plugins, die durch die AddPlugin-Direktive in der conf-Datei oder die
--plugin oder -P Option geladen werden, können von der Plugin-Liste wieder
entfernt werden, wenn man "AddPlugin -name", --plugin="-name" oder -P-name
@@ -80,6 +106,45 @@ die Hilfestellung von VDR aus, und nicht die Hilfestellung von runvdr.
+runvdr-conf.d
+--------------------------------------------------------------------------
+
+Mit runvdr-conf.d steht ein (optionales) Tool zur Verfügung, das das
+Verwalten der Plugins erleichtern soll. Es funktioniert nach dem init.d
+Prinzip, bei dem in einem Verzeichnis mehrere symbolische Links auf Dateien
+abgelegt werden, die in alphabetischer Reihenfolge abgearbeitet werden.
+
+Im Falle von runvdr-conf.d legt man pro zu ladendem Plugin eine eigene
+Konfigurationsdatei nach Vorbild der skeleton.example in /etc/runvdr/ ab.
+Geladen werden Plugins, deren symbolischer Link unter /etc/runvdr/conf.d
+liegt. Dazu muss in der runvdr.conf die passende INCLUDE-Zeile aktiviert
+werden.
+
+Folgende Befehle stehen zur Verfügung, um die aktiven Plugins zu verwalten:
+
+runvdr-conf.d show [name]
+ Zeigt alle Plugins bzw. ein Plugin an, inklusive Name und Ladepriorität.
+ 'name' ist der Dateiname im Verzeichnis /etc/runvdr/.
+
+runvdr-conf.d enable name [--prio XX]
+ Aktiviere Plugin für nächsten Neustart. Verwendet Default-Priorität oder
+ die angegebene Priorität. Dazu wird ein symbolischer Link auf die Datei
+ /etc/runvdr/name unter /etc/runvdr/conf.d/XXname abgelegt.
+
+runvdr-conf.d disable name
+ Deaktiviert ein Plugin ab dem nächsten Neustart, d.h. löscht den Link
+ unter /etc/runvdr/conf.d/XXname.
+
+runvdr-conf.d osdserver [--debug]
+ Verbindet mit OSD-Server Plugin und erlaubt das Konfigurieren der Plugins
+ per VDR OSD. Von dort können Plugins aktiviert und deaktivert werden, und
+ die Ladepriorität gesetzt werden.
+ Ohne --debug kehrt runvdr-conf.d sofort zurück und trennt sich von der
+ Standard-Ein/Ausgabe, kann also von der commands.conf direkt aufgerufen
+ werden. Mit --debug wird die OSD-Server Kommunikation ausgegeben.
+
+
+
Voraussetzungen
--------------------------------------------------------------------------
Unix-Kommandos, die runvdr benutzt:
diff --git a/init.d.runvdr.Debian b/init.d.runvdr.Debian
new file mode 100755
index 0000000..6734249
--- /dev/null
+++ b/init.d.runvdr.Debian
@@ -0,0 +1,83 @@
+#! /bin/sh
+#
+# runvdr init.d script for Debain and compatible distributions
+#
+# by Udo Richter <udo_richter(a)gmx.de>
+# http://www.richter-udo.de/vdr/scripts.html#runvdr
+#
+
+set -e
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DESC="Runvdr Extreme"
+NAME=runvdr
+DAEMON=/usr/local/bin/runvdr
+PIDFILE=/var/run/runvdr.pid
+SCRIPTNAME=/etc/init.d/runvdr
+
+# Gracefully exit if the package has been removed.
+test -x $DAEMON || exit 0
+
+#
+# Function that starts runvdr.
+#
+d_start() {
+ start-stop-daemon --start --background --quiet --pidfile $PIDFILE \
+ --exec $DAEMON --
+}
+
+#
+# Function that stops runvdr.
+#
+d_stop() {
+ $DAEMON --terminate --wait=30
+}
+
+#
+# Function that sends a restart to runvdr.
+#
+d_reload() {
+ $DAEMON --restart
+}
+
+#
+# Function that sends a dvb-reload to runvdr.
+#
+d_dvb_reload() {
+ $DAEMON --dvb-restart
+}
+
+case "$1" in
+ start)
+ echo -n "Starting $DESC: $NAME"
+ d_start
+ echo "."
+ ;;
+ stop)
+ echo "Stopping $DESC: $NAME".
+ d_stop
+ ;;
+ reload)
+ echo -n "Reloading $DESC configuration"
+ d_reload
+ echo "."
+ ;;
+ dvb-reload)
+ echo -n "Reloading $DESC configuration"
+ d_dvb_reload
+ echo "."
+ ;;
+ restart|force-reload)
+ echo -n "Restarting $DESC: $NAME"
+ d_stop
+ sleep 1
+ d_start
+ echo "."
+ ;;
+ *)
+ echo "Usage: $SCRIPTNAME {start|stop|restart|dvb-restart|reload|force-reload}" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/runvdr b/runvdr
index 1d895b7..99e68ba 100755
--- a/runvdr
+++ b/runvdr
@@ -45,37 +45,39 @@ SETTERM="setterm"
#
# Supported options of VDR
#
-# -a # --audio # AUDIO send Dolby Digital audio to stdin of command #
-# -c # --config # CONFIGDIR read config files from DIR
-# -d --daemon DAEMON run in daemon mode
-# -D # --device # DVBDEVICE use only the given DVB device (NUM = 0, 1, 2...)
-# -E # --epgfile # EPGFILE write the EPG data into the given FILE. - to disable.
-# -g # --grab # GRAB write images from the SVDRP command GRAB into the given DIR;
-# -L # --lib # LIBDIR search for plugins in DIR (default is %s)
-# --lirc #? LIRC use a LIRC remote control device, attached to PATH
-# -l # --log # LOGLEVEL set log level (default: 3)
-# -m --mute MUTE mute audio of the primary DVB device at startup
-# --no-kbd NOKBD don't use the keyboard as an input device
-# -P # --plugin # PLUGINS load a plugin defined by the given options
-# -p # --port # SVDRPPORT use PORT for SVDRP
-# --rcu #? RCU use a remote control device, attached to PATH
-# -r # --record # RECORDCMD call CMD before and after a recording
-# -s # --shutdown # SHUTDOWN call CMD to shutdown the computer
-# -t # --terminal # TERMINAL controlling tty
-# -u # --user # USER run as user USER; only applicable if started as root
-# --vfat VFAT encode special characters in recording names
-# -v # --video # VIDEODIR use DIR as video directory
-# -w # --watchdog # WATCHDOG activate the watchdog timer with a timeout of SEC
-
-
-which $PGREP >/dev/null || { echo missing $PGREP... >2 ; exit 1 ; }
-which $PS >/dev/null || { echo missing $PS... >2 ; exit 1 ; }
-which $GETOPT >/dev/null || { echo missing $GETOPT... >2 ; exit 1 ; }
-which $KILL >/dev/null || { echo missing $KILL... >2 ; exit 1 ; }
-which $SLEEP >/dev/null || { echo missing $SLEEP... >2 ; exit 1 ; }
-which $CHVT >/dev/null || { echo missing $CHVT... >2 ; exit 1 ; }
-which $DATE >/dev/null || { echo missing $DATE... >2 ; exit 1 ; }
-which $SETTERM >/dev/null || { echo missing $SETTERM... >2 ; exit 1 ; }
+# -a # --audio # AUDIO send Dolby Digital audio to stdin of command #
+# -c # --config # CONFIGDIR read config files from DIR
+# -d --daemon DAEMON run in daemon mode
+# -D # --device # DVBDEVICE use only the given DVB device (NUM = 0, 1, 2...)
+# -E # --epgfile # EPGFILE write the EPG data into the given FILE. - to disable.
+# -g # --grab # GRAB write images from the SVDRP command GRAB into the given DIR;
+# -L # --lib # LIBDIR search for plugins in DIR (default is %s)
+# --lirc #? LIRC use a LIRC remote control device, attached to PATH
+# --localedir # LOCALEDIR search for locale files in DIR
+# -l # --log # LOGLEVEL set log level (default: 3)
+# -m --mute MUTE mute audio of the primary DVB device at startup
+# --no-kbd NOKBD don't use the keyboard as an input device
+# -P # --plugin # PLUGINS load a plugin defined by the given options
+# -p # --port # SVDRPPORT use PORT for SVDRP
+# --rcu #? RCU use a remote control device, attached to PATH
+# -r # --record # RECORDCMD call CMD before and after a recording
+# -s # --shutdown # SHUTDOWN call CMD to shutdown the computer
+# -t # --terminal # TERMINAL controlling tty
+# -u # --user # USER run as user USER; only applicable if started as root
+# --userdump USERDUMP allow coredumps if -u is given (debugging)
+# --vfat VFAT encode special characters in recording names
+# -v # --video # VIDEODIR use DIR as video directory
+# -w # --watchdog # WATCHDOG activate the watchdog timer with a timeout of SEC
+
+
+which $PGREP >/dev/null || { echo missing $PGREP... >&2 ; exit 1 ; }
+which $PS >/dev/null || { echo missing $PS... >&2 ; exit 1 ; }
+which $GETOPT >/dev/null || { echo missing $GETOPT... >&2 ; exit 1 ; }
+which $KILL >/dev/null || { echo missing $KILL... >&2 ; exit 1 ; }
+which $SLEEP >/dev/null || { echo missing $SLEEP... >&2 ; exit 1 ; }
+which $CHVT >/dev/null || { echo missing $CHVT... >&2 ; exit 1 ; }
+which $DATE >/dev/null || { echo missing $DATE... >&2 ; exit 1 ; }
+which $SETTERM >/dev/null || { echo missing $SETTERM... >&2 ; exit 1 ; }
@@ -89,8 +91,8 @@ function ParseCommandLine_Step1() {
runvdr-pid:,dvb-load:,dvb-unload:,language:,wrapper:,\
term-timeout:,kill-timeout:,terminate::,restart::,dvb-restart::,\
wait::,audio:,config:,daemon,device:,epgfile:,grab:,help,lib:,lirc::,\
- log:,mute,no-kbd,plugin:,port:,rcu::,record:,shutdown:,\
- terminal:,user:,version,vfat,video:,watchdog:"
+ log:,localedir:,mute,no-kbd,plugin:,port:,rcu::,record:,shutdown:,\
+ terminal:,user:,userdump,version,vfat,video:,watchdog:"
# prepare all optios for later processing
@@ -111,7 +113,7 @@ function ParseCommandLine_Step1() {
break
;;
*)
- echo "Internal error!" >2
+ echo "Internal error!" >&2
exit 1
;;
esac ; done
@@ -146,6 +148,7 @@ function Clean() {
LIBDIR=
LIRC=
LOGLEVEL=
+ LOCALEDIR=
MUTE=
NOKBD=
PLUGINS=()
@@ -154,7 +157,8 @@ function Clean() {
RCU=
SHUTDOWN=
TERMINAL=
- VDRUSER=
+ USER=
+ USERDUMP=
VFAT=
VIDEODIR=
WATCHDOG=
@@ -221,20 +225,24 @@ function AddDevice() {
function INCLUDE() {
- # include different conf file
- if [ -n "$1" ] ; then
- if [ -r "$1" ] ; then
- . "$1" || exit 1
+ # include different conf file(s)
+
+ for file ; do
+ if [ -r "$file" ] ; then
+ . "$file" || exit 1
else
- echo "runvdr: $1 not found." >&2
+ echo "runvdr: $file not found." >&2
fi
- fi
+ done
}
function LoadConfFile() {
# Load configuration file
+ VDRUSER=""
+ # Old option, supported for compatibility only
+
if [ -z "$RUNVDRCONF" -a -r ~/.runvdr.conf ] ; then
RUNVDRCONF=~/.runvdr.conf
fi
@@ -248,6 +256,11 @@ function LoadConfFile() {
echo "runvdr: $RUNVDRCONF not found." >&2
fi
fi
+
+ if [ -n "$VDRUSER" ] ; then
+ echo "runvdr: VDRUSER is deprecated. Use USER= instead."
+ [ -n "$USER" ] && USER="$VDRUSER"
+ fi
# Transform some defaults, so empty parameters can have a
# non-default meaning
@@ -297,6 +310,7 @@ function ParseCommandLine_Step2() {
-l|--log) LOGLEVEL="$2"; shift 2;;
-L|--lib) LIBDIR="$2"; shift 2;;
--lirc) LIRC="$2"; shift 2;;
+ --localedir) LOCALEDIR="$2"; shift 2;;
-m|--mute) MUTE=1; shift ;;
--no-kbd) NOKBD=1; shift ;;
-p|--port) SVDRPPORT="$2"; shift 2;;
@@ -306,6 +320,7 @@ function ParseCommandLine_Step2() {
-s|--shutdown) SHUTDOWN="$2"; shift 2;;
-t|--terminal) TERMINAL="$2"; shift 2;;
-u|--user) USER="$2"; shift 2;;
+ --userdump) USERDUMP="$2"; shift ;;
-v|--video) VIDEODIR="$2"; shift 2;;
--vfat) VFAT=1; shift ;;
-w|--watchdog) WATCHDOG="$2"; shift 2;;
@@ -316,7 +331,7 @@ function ParseCommandLine_Step2() {
break
;;
*)
- echo "Internal error!" >2
+ echo "Internal error!" >&2
exit 1
;;
esac ; done
@@ -358,31 +373,33 @@ runvdr Options:
-h, --help print this help and exit
Parsed VDR options:
--a # --audio=# send Dolby Digital audio to stdin of command CMD
--c # --config=# read config files from DIR
--d --daemon run in daemon mode
--D # --device=# use only the given DVB device (NUM = 0, 1, 2...)
- Use '-' to override devices from config file
- Use '-x' to ignore device x from config file
--E # --epgfile=# write the EPG data into the given FILE. - to disable.
--g # --grab=# write images from the SVDRP command GRAB into the given DIR
--L # --lib=# search for plugins in DIR
- --lirc[=#] use a LIRC remote control device, attached to PATH
--l # --log=# set log level
--m --mute mute audio of the primary DVB device at startup
- --no-kbd don't use the keyboard as an input device
--P # --plugin=# load a plugin defined by the given options
- Use '-' to ignore all plugins from config file
- Use '-xx' to ignore plugin xx from config file
--p # --port=# use PORT for SVDRP
- --rcu[=#] use a remote control device, attached to PATH
--r # --record=# call CMD before and after a recording
--s # --shutdown=# call CMD to shutdown the computer
--t # --terminal=# controlling tty
--u # --user=# run as user USER; only applicable if started as root
- --vfat encode special characters in recording names
--v # --video=# use DIR as video directory
--w # --watchdog=# activate the watchdog timer with a timeout of SEC
+-a # --audio=# send Dolby Digital audio to stdin of command CMD
+-c # --config=# read config files from DIR
+-d --daemon run in daemon mode
+-D # --device=# use only the given DVB device (NUM = 0, 1, 2...)
+ Use '-' to override devices from config file
+ Use '-x' to ignore device x from config file
+-E # --epgfile=# write the EPG data into the given FILE. - to disable.
+-g # --grab=# write images from the SVDRP command GRAB into the given DIR
+-L # --lib=# search for plugins in DIR
+ --lirc[=#] use a LIRC remote control device, attached to PATH
+ --localedir=# search for locale files in DIR
+-l # --log=# set log level
+-m --mute mute audio of the primary DVB device at startup
+ --no-kbd don't use the keyboard as an input device
+-P # --plugin=# load a plugin defined by the given options
+ Use '-' to ignore all plugins from config file
+ Use '-xx' to ignore plugin xx from config file
+-p # --port=# use PORT for SVDRP
+ --rcu[=#] use a remote control device, attached to PATH
+-r # --record=# call CMD before and after a recording
+-s # --shutdown=# call CMD to shutdown the computer
+-t # --terminal=# controlling tty
+-u # --user=# run as user USER; only applicable if started as root
+ --userdump allow coredumps if -u is given (debugging)
+ --vfat encode special characters in recording names
+-v # --video=# use DIR as video directory
+-w # --watchdog=# activate the watchdog timer with a timeout of SEC
All runvdr parameters after '--' will be passed to VDR without modification
END-OF-HELP
@@ -420,6 +437,7 @@ function BuildCommand() {
0) ;;
*) VDRCMD="$VDRCMD --lirc=\"$LIRC\"";;
esac
+ [ -n "$LOCALEDIR" ] && VDRCMD="$VDRCMD --localedir \"$LOCALEDIR\""
[ -n "$MUTE" ] && VDRCMD="$VDRCMD -m"
[ -n "$NOKBD" ] && VDRCMD="$VDRCMD --no-kbd"
[ -n "$SVDRPPORT" ] && VDRCMD="$VDRCMD -p $SVDRPPORT"
@@ -447,9 +465,11 @@ function BuildCommand() {
0) ;;
*) VDRCMD="$VDRCMD --rcu=\"$RCU\"";;
esac
+
[ -n "$SHUTDOWN" ] && VDRCMD="$VDRCMD -s \"$SHUTDOWN\""
[ -n "$TERMINAL" ] && VDRCMD="$VDRCMD -t \"$TERMINAL\""
- [ -n "$VDRUSER" ] && VDRCMD="$VDRCMD -u \"$VDRUSER\""
+ [ -n "$USER" ] && VDRCMD="$VDRCMD -u \"$USER\""
+ [ -n "$USERDUMP" ] && VDRCMD="$VDRCMD --userdump"
[ -n "$VFAT" ] && VDRCMD="$VDRCMD --vfat"
[ -n "$VIDEODIR" ] && VDRCMD="$VDRCMD -v \"$VIDEODIR\""
[ -n "$WATCHDOG" ] && VDRCMD="$VDRCMD -w $WATCHDOG"
@@ -532,7 +552,7 @@ if [ -n "$HELP" ] ; then
fi
if [ -n "$VERSION" ] ; then
- echo "runvdr version 0.2.0"
+ echo "runvdr extreme version 0.3.0"
exit 0
fi
diff --git a/runvdr-conf.d b/runvdr-conf.d
new file mode 100755
index 0000000..e1a4103
--- /dev/null
+++ b/runvdr-conf.d
@@ -0,0 +1,425 @@
+#!/bin/bash
+
+ALLSCRIPTS="/etc/runvdr"
+ACTIVESCRIPTS="/etc/runvdr/conf.d"
+LINKREL="../"
+
+#####################
+# OSDServer helpers #
+#####################
+
+# convenient return values
+true=0
+false=1
+
+function error() {
+ # Fatal error. Send quit command, close FIFO and terminate netcat
+ [ "${reply2xx[0]}" != 202 ] && SendCmd Quit
+
+ exec 3>&-
+ exec 4>&-
+
+ kill $pid
+
+ exit 1
+}
+
+function ConnectServer() {
+ # Connect to the OSDServer
+
+ # Set up temporary fifo and open as file descriptor 3 and 4
+ mkfifo --mode=700 /tmp/pipe-in$$ /tmp/pipe-out$$
+ exec 3<> /tmp/pipe-in$$
+ exec 4<> /tmp/pipe-out$$
+ rm /tmp/pipe-in$$ /tmp/pipe-out$$
+
+ # Connect to server using the fifo
+ {
+ netcat $1 $2
+
+ # In case of connection loss:
+ echo 499 disconnected
+ echo 202 Good Bye.
+ } <&3 >&4 &
+ pid=$!
+
+ # Sending to the server: use >&3
+ # Receive from the server: use <&4
+}
+
+
+function ReadReply() {
+ # Read a complete server reply until 2xx return code,
+ # and store replies in each category by number
+ reply2xx=()
+ reply3xx=()
+ reply4xx=()
+ reply5xx=()
+ reply6xx=()
+
+ while read -r code line <&4 ; do
+ if [ "$OSDSERVER_DEBUG" ] ; then echo "< $code $line" ; fi
+ # screen echo
+
+ case $code in
+ 2*) IFS=$' \t\n\r' reply2xx=($code "$line")
+ ;;
+ 3*) IFS=$' \t\n\r' reply3xx=($code $line)
+ ;;
+ 4*) IFS=$' \t\n\r' reply4xx=($code "$line")
+ ;;
+ 5*) IFS=$' \t\n\r' reply5xx=($code "$line")
+ ;;
+ 6*) IFS=$' \t\n\r' reply6xx=($code "$line")
+ ;;
+ esac
+ [ -n "${reply2xx[0]}" ] && break
+ done
+
+ [ -n "${reply4xx[0]}" ] && return $false
+ return $true
+}
+
+function SendCmd() {
+ # Send a command and read the reply
+
+ if [ "$OSDSERVER_DEBUG" ] ; then echo "> $*" ; fi
+ # screen echo
+
+ echo "$*" >&3
+ # network send
+
+ ReadReply
+}
+
+function IsEvent() {
+ # Helper to check reply for a certain event
+
+ [ "${reply3xx[0]}" != 300 ] && return $false
+ [ "${reply3xx[1]}" != "$1" ] && return $false
+ [ "${reply3xx[2]}" != "$2" ] && return $false
+
+ return $true
+}
+
+
+function QuoteString() {
+ # Quote arbitrary string for use in '' and ""
+ local str="${!1}"
+
+ str="${str//'\'/\\\\}"
+ str="${str//'\\'/\\\\}"
+ # work around bash bug: double quoted '\'
+
+ str="${str//\'/$'\\\''}"
+ # This is bogus, anyone knows something better to replace ' by \' ?
+
+ str="${str//\"/\\\"}"
+ str="${str//$'\r'/\\r}"
+ str="${str//$'\n'/\\n}"
+ str="${str//$'\t'/\\t}"
+
+ eval "$1=\$str"
+}
+
+function UnquoteString() {
+ # Unquote string
+ local str="${!1}"
+
+ str="${str//\\r/$'\r'}"
+ str="${str//\\n/$'\n'}"
+ str="${str//\\t/$'\t'}"
+ str="${str//\\\"/\"}"
+ str="${str//\\\'/\'}"
+ str="${str//\\\\/\\}"
+
+ eval "$1=\$str"
+}
+
+#########################
+# runvdr-conf.d helpers #
+#########################
+
+function GetConfInfo() {
+ name=""
+ defaultprio=50
+ loaded=""
+ local tmp
+
+ if [ ! -f "$ALLSCRIPTS/$1" ] ; then
+ return 1
+ fi
+ while read -r line ; do
+ tmp="${line#\# Plugin name:}"
+ if [ "$tmp" != "$line" ] ; then
+ name="${tmp# }"
+ fi
+ tmp="${line#\# Default priority:}"
+ if [ "$tmp" != "$line" ] ; then
+ tmp="${tmp#\# Default priority:}"
+ while [ "${tmp# }" != "$tmp" ] ; do tmp="${tmp# }" ; done
+ while [ "${tmp% }" != "$tmp" ] ; do tmp="${tmp% }" ; done
+ if [ -z "${tmp#[0-9]}" ] ; then tmp="0$tmp" ; fi
+ if [ -z "${tmp#[0-9][0-9]}" ] ; then
+ defaultprio="$tmp"
+ fi
+ fi
+ done < "$ALLSCRIPTS/$1"
+ if [ -z "$name" ] ; then
+ return 1
+ fi
+
+ tmp=("$ACTIVESCRIPTS"/[0-9][0-9]"$1")
+ tmp="${tmp[0]}"
+ if [ -f "$tmp" ] ; then
+ tmp="${tmp:${#ACTIVESCRIPTS}+1}"
+ loaded="${tmp:0:2}"
+ fi
+
+ return 0
+}
+
+function GetAllConfInfo() {
+ local glob="*"
+ if [ "$1" ] ; then glob="$1" ; fi
+ confs=0
+ confs_short=()
+ confs_name=()
+ confs_defaultprio=()
+ confs_loaded=()
+ local i
+ for i in "$ALLSCRIPTS"/$glob ; do
+ i="${i:${#ALLSCRIPTS}+1}"
+ if [ -f "$ALLSCRIPTS/$i" ] && GetConfInfo "$i" ; then
+ confs_short[$confs]="$i"
+ confs_name[$confs]="$name"
+ confs_defaultprio[$confs]="$defaultprio"
+ confs_loaded[$confs]="$loaded"
+ let confs++
+ fi
+ done
+}
+
+
+function Command_Show() {
+ GetAllConfInfo "$1"
+
+ local i;
+ for ((i=0;i<confs;i++)) ; do
+ if [ $i -ne 0 ] ; then
+ echo
+ fi
+ echo "Plugin short name: ${confs_short[i]}"
+ echo "Plugin long name : ${confs_name[i]}"
+ echo "Default priority : ${confs_defaultprio[i]}"
+ echo "Loaded priority : ${confs_loaded[i]:---}"
+ done
+}
+
+function Command_Enable() {
+ short="$1"
+ if [ -z "$short" ] ; then
+ echo "Usage: $0 enable conf-name [--prio #]"
+ exit 1
+ fi
+ GetConfInfo "$short" || { echo "Unknown Plugin $short" >&2 ; exit 1 ; }
+ newloaded="$loaded"
+ if [ -z "$newloaded" ] ; then
+ newloaded="$defaultprio"
+ fi
+
+ if [ "$2" == "--prio" ] ; then
+ newloaded="$3"
+ while [ "${newloaded# }" != "$newloaded" ] ; do newloaded="${newloaded# }" ; done
+ while [ "${newloaded% }" != "$newloaded" ] ; do newloaded="${newloaded% }" ; done
+ if [ -z "${newloaded#[0-9]}" ] ; then newloaded="0$newloaded" ; fi
+ if [ "${newloaded#[0-9][0-9]}" ] ; then
+ echo "Not a valid priority: $3" >&2
+ exit 1
+ fi
+ fi
+ echo -n "Enabling $name"
+ mkdir -p "$ACTIVESCRIPTS"
+ if [ "$loaded" ] ; then
+ rm -f "$ACTIVESCRIPTS"/[0-9][0-9]"$short"
+ fi
+ ln -s "$LINKREL$short" "$ACTIVESCRIPTS/$newloaded$short"
+ echo "."
+}
+
+function Command_Disable() {
+ short="$1"
+ if [ -z "$short" ] ; then
+ echo "Usage: $0 disable conf-name"
+ exit 1
+ fi
+ GetConfInfo "$short" || { echo "Unknown Plugin $short" >&2 ; exit 1 ; }
+ if [ -z "$loaded" ] ; then
+ echo "$short is not loaded." >&2
+ exit 1
+ fi
+ echo -n "Disabling $name"
+ rm -f "$ACTIVESCRIPTS"/[0-9][0-9]"$short"
+ echo "."
+}
+
+function Osdserver_edit() {
+ local short="${confs_short[$1]}"
+ QuoteString short
+ local name="${confs_name[$1]}"
+ QuoteString name
+ local defaultprio="${confs_defaultprio[$1]}"
+ local loaded="${confs_loaded[$1]}"
+ local enable="Yes"
+ if [ -z "$loaded" ] ; then
+ enable="No"
+ loaded="$defaultprio"
+ fi
+
+ SendCmd "enterlocal" || return $false
+ # Preserve global variable space, so we can re-use 'menu'
+
+ SendCmd "menu=New Menu 'Edit $name'" || return $false
+ SendCmd "menu.SetColumns 15" || return $false
+ SendCmd "menu.EnableEvent keyOk close" || return $false
+
+ SendCmd "menu.AddNew OsdItem -unselectable 'Short name:\\t$short'" || return $false
+
+ SendCmd "menu.AddNew OsdItem -unselectable 'Long name:\\t$name'" || return $false
+
+ SendCmd "menu.AddNew OsdItem -unselectable 'Default priority:\\t$defaultprio'" || return $false
+
+ SendCmd "enable=menu.AddNew EditListItem Enabled No Yes -SelectName '$enable'" || return $false
+ SendCmd "enable.SetCurrent" || return $false
+
+ SendCmd "prio=menu.AddNew EditIntItem -min 0 -max 99 'Current priority:' '$loaded'" || return $false
+
+ SendCmd "_focus.addsubmenu menu" || return $false
+ SendCmd "menu.show" || return $false
+
+ while true; do
+ SendCmd "menu.SleepEvent" || return $false
+
+ if IsEvent menu keyOk ; then
+ SendCmd "enable.GetValue -name" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ enable="${reply6xx[1]}"
+
+ SendCmd "prio.GetValue" || return $false
+ [ "${reply6xx[0]}" != 600 ] && return $false
+ prio="${reply6xx[1]}"
+
+ if [ "$enable" == "Yes" ] ; then
+ Command_Enable "$short" --prio "$prio"
+ confs_loaded[$1]="$prio"
+ elif [ -n "${confs_loaded[$1]}" ] ; then
+ Command_Disable "$short"
+ confs_loaded[$1]=""
+ fi
+
+ SendCmd "menu.SendState osBack" || return $false
+ SendCmd "delete menu" || return $false
+ SendCmd "leavelocal" || return $false
+
+ return $true
+ fi
+ if IsEvent menu close ; then
+ SendCmd "delete menu" || return $false
+ SendCmd "leavelocal" || return $false
+ return $true
+ fi
+ done
+}
+
+function Osdserver_main() {
+ SendCmd "menu=New Menu 'Runvdr config'" || return $false
+ SendCmd "menu.SetColumns 5" || return $false
+ SendCmd "menu.EnableEvent close" || return $false
+
+ local i;
+ local min=0
+ local prio
+ until [ "$min" -ge 100 ] ; do
+ local nextmin=100
+ for ((i=0;i<confs;i++)) ; do
+ prio="${confs_defaultprio[i]}"
+ if [ -n "${confs_loaded[i]}" ] ; then prio=${confs_loaded[i]} ; fi
+
+ if [ "$prio" -eq "$min" ] ; then
+ SendCmd "conf$i=menu.AddNew OsdItem '${confs_loaded[i]:---}\t${confs_name[i]}'" || return $false
+ SendCmd "conf$i.EnableEvent keyOk" || return $false
+ fi
+ if [ "$prio" -gt "$min" -a "$prio" -lt "$nextmin" ] ; then
+ nextmin="$prio"
+ fi
+ done
+ min="$nextmin"
+ done
+
+ SendCmd "menu.Show" || return $false
+
+ while true ; do
+ SendCmd "menu.SleepEvent" || return $false
+
+ if IsEvent menu close ; then
+ return $true
+ fi
+
+ if [ "${reply3xx[1]:0:4}" == "conf" -a "${reply3xx[2]}" == "keyOk" ] ; then
+ i="${reply3xx[1]:4}"
+ Osdserver_edit "$i" || return $false
+ SendCmd "conf$i.SetText '${confs_loaded[i]:---}\t${confs_name[i]}'" || return $false
+ SendCmd "menu.Show" || return $false
+ fi
+ done
+}
+
+function Osdserver_connect() {
+ GetAllConfInfo
+
+ ConnectServer localhost 2010
+ # Connect to the server process
+
+ ReadReply || error
+ # Read server welcome
+
+ SendCmd "Version 0.1" || error
+ # Identify to server with protocol version
+
+ Osdserver_main || error
+ # Main menu
+
+ SendCmd Quit
+ # ... and good bye
+
+ exec 3>&-
+ exec 4>&-
+ # close FIFOs
+}
+
+function Command_Osdserver() {
+ if [ "$1" == "--debug" ] ; then
+ OSDSERVER_DEBUG=1
+ Osdserver_connect
+ else
+ Osdserver_connect </dev/null >/dev/null &
+ fi
+}
+
+if [ "$1" == "show" ] ; then
+ shift
+ Command_Show "$@"
+elif [ "$1" == "enable" ] ; then
+ shift
+ Command_Enable "$@"
+elif [ "$1" == "disable" ] ; then
+ shift
+ Command_Disable "$@"
+elif [ "$1" == "osdserver" ] ; then
+ shift
+ Command_Osdserver "$@"
+else
+ test
+ echo "Unknown command: $1" >&2
+fi
+
diff --git a/runvdr.conf.example b/runvdr.conf.example
index 85dc41b..8e31eaf 100644
--- a/runvdr.conf.example
+++ b/runvdr.conf.example
@@ -9,11 +9,17 @@
# Include other configuration file for defaults
-# Must be first, or will override all previous settings
+# Must be first, or will override all previous settings.
+# You can also use wildcards to load several files in lexicographic order:
+# INCLUDE /etc/runvdr/plugins.d/*
# You may want to use this in ~/.runvdr.conf if you also want to load
# /etc/runvdr.conf. DO NOT create infinite loops with this!
#
# INCLUDE /etc/runvdr.conf
+#
+# For use with runvdr-conf.d, un-comment this line:
+# INCLUDE /etc/runvdr/conf.d/*
+
##### -------------------------
@@ -39,6 +45,10 @@ VIDEODIR="/video"
# from the video directory).
CONFIGDIR="/video"
+# Location of locale files for VDR 1.5.14 and newer. Default is to use
+# the builtin "./locale" or whatever was compiled as LOCDIR into VDR.
+#
+# LOCALEDIR="/usr/src/vdr/locale"
##### -----------
##### Plugins
@@ -81,7 +91,7 @@ LIBDIR=
# 'root' is necessary if the system time shall be set from the transponder
# data, but for security reasons vdr can switch to a lesser privileged user
# id during normal operation.
-VDRUSER=""
+USER=""
# Write the EPG data into EPGFILE. Default is /video/epg.data.
# Use EPGFILE=- to disable this. If EPGFILE is a directory, the file
@@ -145,6 +155,9 @@ RCU=
# with VFAT file systems
VFAT=
+# Allow coredumps if USER= is given (debugging)
+# USERDUMP="1"
+
# Store PID of runvdr into a file?
# RUNVDRPID=~/.runvdr.pid
RUNVDRPID=/var/run/runvdr.pid
diff --git a/skeleton.example b/skeleton.example
new file mode 100644
index 0000000..e663850
--- /dev/null
+++ b/skeleton.example
@@ -0,0 +1,7 @@
+# Skeleton config file for placing in /etc/runvdr/
+
+# The next two lines must be present:
+# Plugin name: Skeleton plugin
+# Default priority: 50
+
+AddPlugin skeleton