aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Schwarzott <zzam@gentoo.org>2005-08-24 04:57:38 +0000
committerMatthias Schwarzott <zzam@gentoo.org>2005-08-24 04:57:38 +0000
commit8c2730d0909c71e8cc16ba95b6bce905773996f3 (patch)
treefe19c778cb7c907657957a5e6bb604958ff226a0
downloadgentoo-vdr-scripts-8c2730d0909c71e8cc16ba95b6bce905773996f3.tar.gz
gentoo-vdr-scripts-8c2730d0909c71e8cc16ba95b6bce905773996f3.tar.bz2
gentoo-vdr-scripts-8c2730d0909c71e8cc16ba95b6bce905773996f3.zip
imported gentoo-vdr-scripts-0.1_alpha1gentoo-vdr-scripts-0.1_alpha1
svn path=/gentoo-vdr-scripts/trunk/; revision=1
-rw-r--r--ChangeLog12
-rw-r--r--Makefile26
-rw-r--r--README11
-rw-r--r--TODO5
-rw-r--r--etc/conf.d/vdr60
-rwxr-xr-xetc/init.d/vdr91
-rw-r--r--etc/vdr/commands/commands.custom.conf7
-rw-r--r--etc/vdr/reccmds/reccmds.custom.conf8
-rw-r--r--to_integrate/module-load10
-rw-r--r--to_integrate/vdr-start4
-rw-r--r--to_integrate/vdrshutdown.sh152
-rw-r--r--usr/lib/vdr/rcscript/functions.sh137
-rw-r--r--usr/lib/vdr/rcscript/post-start-50-svdrp.sh32
-rw-r--r--usr/lib/vdr/rcscript/pre-start-20-dvb-device.sh9
-rw-r--r--usr/lib/vdr/rcscript/pre-start-30-parameter.sh17
-rw-r--r--usr/lib/vdr/rcscript/pre-start-40-create-commands-conf.sh43
-rw-r--r--usr/lib/vdr/record-gate2
-rwxr-xr-xusr/sbin/vdr-watchdogd41
18 files changed, 667 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..46d2e37
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,12 @@
+# ChangeLog for gentoo-vdr-scripts
+
+*gentoo-vdr-scripts-0.1_alpha1 (12 Aug 2005)
+
+ 12 Aug 2005; Matthias Schwarzott <zzam@gentoo.org>:
+ added script for creation of commands.conf
+ and reccmds.conf files
+
+ 27 Jul 2005; Matthias Schwarzott <zzam@gentoo.org>:
+ First created package of scripts.
+ Scripts are from either me or
+ imported from gentoo.de repository
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..67c01f4
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,26 @@
+
+all:
+ @echo nothing to compile
+
+install:
+ mkdir -p $(DESTDIR)/etc/{conf.d,init.d}
+ install -m 0644 -o root -g root etc/conf.d/vdr $(DESTDIR)/etc/conf.d/vdr
+ install -m 0755 -o root -g root etc/init.d/vdr $(DESTDIR)/etc/init.d/vdr
+
+ mkdir -p $(DESTDIR)/usr/sbin
+ install -m 0755 -o root -g root usr/sbin/vdr-watchdogd $(DESTDIR)/usr/sbin
+
+ #mkdir -p $(DESTDIR)/usr/bin
+ #install -m 0755 -o root -g root usr/bin/vdr-start $(DESTDIR)/usr/bin
+
+ mkdir -p $(DESTDIR)/usr/lib/vdr/rcscript
+ install -m 0644 -o root -g root usr/lib/vdr/rcscript/*.sh $(DESTDIR)/usr/lib/vdr/rcscript/
+
+ mkdir -p $(DESTDIR)/var/vdr
+
+ mkdir -p $(DESTDIR)/etc/vdr/commands
+ install -m 0644 -o root -g root etc/vdr/commands/commands.*.conf $(DESTDIR)/etc/vdr/commands
+ mkdir -p $(DESTDIR)/etc/vdr/reccmds
+ install -m 0644 -o root -g root etc/vdr/reccmds/reccmds.*.conf $(DESTDIR)/etc/vdr/reccmds
+
+.PHONY: all install
diff --git a/README b/README
new file mode 100644
index 0000000..e831722
--- /dev/null
+++ b/README
@@ -0,0 +1,11 @@
+README for gentoo-vdr-scripts
+
+This package contains all support scripts for vdr to make
+it like a real set top box.
+
+#TODO: Not used up to now
+#Dependencies:
+# nvram-wakeup when being used for setting wakeup time
+
+Author:
+ Matthias Schwarzott <zzam@gentoo.org>
diff --git a/TODO b/TODO
new file mode 100644
index 0000000..a3a7f26
--- /dev/null
+++ b/TODO
@@ -0,0 +1,5 @@
+TODO file for gentoo-vdr-scripts
+
+* Add record script/hooks
+* Add shutdown scripts/hooks
+* create possibility to start vdr under x (for softdevice etc.)
diff --git a/etc/conf.d/vdr b/etc/conf.d/vdr
new file mode 100644
index 0000000..005c3dd
--- /dev/null
+++ b/etc/conf.d/vdr
@@ -0,0 +1,60 @@
+# /etc/conf.d/vdr:
+
+# Global config file for vdr rc-scripts
+
+# check 5 seconds for existing dvb devices, for example for slow udev
+# you need to disable this for systems which only use network input
+# (default is enabled)
+#DEVICE_CHECK="disabled"
+
+# activate the watchdog timer with a timeout of SEC
+# seconds (default: 0); '0' disables the watchdog
+#WATCHDOG="60"
+
+# send Dolby Digital audio to stdin of command CMD
+#AC3_AUDIO=""
+
+# mute audio of the primary DVB device at startup
+# (default is to unmute)
+#MUTE="1"
+
+# read config files from DIR (default is to read them
+# from /etc/vdr directory)
+#CONFIG="/etc/vdr"
+
+# use only the given DVB device (NUM = 0, 1, 2...)
+# there may be several NUMs options (default: all DVB
+# devices will be used)
+#DEVICE=""
+
+# write the EPG data into the given FILE (default is
+# /video/epg.data); use '-E-' to disable this
+# if FILE is a directory, the default EPG file will be
+# created in that directory
+#EPGFILE="/var/vdr/epg.data"
+
+# set log level (default: 3)
+# 0 = no logging, 1 = errors only,
+# 2 = errors and info, 3 = errors, info and debug
+# if logging should be done to LOG_LOCALn instead of
+# LOG_USER, add '.n' to LEVEL, as in 3.7 (n=0..7)
+#LOG="3"
+
+# use DIR as video directory (default: /video)
+#VIDEO="/video"
+
+# use PORT for SVDRP (default: 2001)
+# 0 turns off SVDRP
+#SVDRP_PORT="2001"
+
+# call CMD to shutdown the computer
+# SHUTDOWN="/usr/bin/vdrshutdown.sh"
+#SHUTDOWN_HOOK="/etc/vdr/vdrshutdown.sh"
+
+# call CMD before and after a recording
+# RECORD="/usr/bin/vdrrecord.sh"
+#RECORD_HOOK=""
+
+# load a plugin defined by the given options
+# list all plugins you want to be loaded, seperated by space
+#PLUGINS=""
diff --git a/etc/init.d/vdr b/etc/init.d/vdr
new file mode 100755
index 0000000..c1cb54b
--- /dev/null
+++ b/etc/init.d/vdr
@@ -0,0 +1,91 @@
+#!/sbin/runscript
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-video/vdr/files/rc.vdr,v 1.23 2005/05/11 20:17:42 zzam Exp $
+
+opts="${opts} fullrestart"
+
+vdr_rcdir=/usr/lib/vdr/rcscript
+source ${vdr_rcdir}/functions.sh
+
+
+depend() {
+ use lircd dvbsplash
+ need net
+ after checkroot
+}
+
+start() {
+ getvdrversion
+ init_params
+
+
+ load_addons_prefixed pre-start || return 1
+
+ for PLUGIN in ${PLUGINS}; do
+ load_plugin ${PLUGIN}
+ done
+
+ if [[ "${waitconditions}" ]]; then
+ ebegin "checking for prerequisits (devices nodes etc.)"
+ waitfor 10 wait_for_multiple_condition
+ exitcode="$?"
+ exitmsg="could not start vdr"
+ case "$exitcode" in
+ 1)
+ exitmsg="${exitmsg}: ${condition_msg}"
+ ;;
+ 2)
+ exitmsg="${exitmsg}: Timeout, ${condition_msg}"
+ ;;
+ esac
+ eend "$exitcode" "${exitmsg}" || return
+ fi
+
+ ebegin "Starting vdr-${vdrversion}"
+
+ #
+ # finally start vdr
+ #
+ /usr/bin/dvbsplash stop 2>/dev/null >/dev/null
+ env --unset=MAIL LD_ASSUME_KERNEL=2.4.1 LOGNAME=vdr USER=vdr HOME=~vdr \
+ start-stop-daemon \
+ --start \
+ --chdir ~vdr \
+ --chuid vdr \
+ --exec /usr/bin/vdr \
+ -- \
+ --daemon "${vdropts[@]}"
+ exitcode=$?
+
+ exit_msg="Failed to start vdr."
+ if [[ "${exitcode}" == "0" ]]; then
+ load_addons_prefixed post-start || exitcode=1
+ fi
+
+ eend $exitcode "${exit_msg}"
+}
+
+stop() {
+ getvdrversion
+ ebegin "Stopping vdr-${vdrversion}"
+
+ # Use --name here to allow us to kill vdr even after a new emerge
+ start-stop-daemon --stop --quiet --retry 15 --name vdr
+ eend $? "Failed to stop vdr."
+}
+
+
+fullrestart() {
+ getvdrversion
+ ebegin "Fully restarting vdr-${vdrversion} and DVB drivers"
+ /etc/init.d/vdr pause
+ /etc/init.d/vdr zap
+ sleep 2
+ test_vdr_process && /bin/killall -9 vdr
+ sleep 1
+ #sleep 5
+ #unload
+ #sleep 3
+ #load
+ /etc/init.d/vdr start
+}
diff --git a/etc/vdr/commands/commands.custom.conf b/etc/vdr/commands/commands.custom.conf
new file mode 100644
index 0000000..bdec45c
--- /dev/null
+++ b/etc/vdr/commands/commands.custom.conf
@@ -0,0 +1,7 @@
+# here you can insert your own commands for the commands menue of vdr.
+#
+#Syntax:
+# title : command
+#
+#Example:
+# show vdr dir : ls -l /etc/vdr
diff --git a/etc/vdr/reccmds/reccmds.custom.conf b/etc/vdr/reccmds/reccmds.custom.conf
new file mode 100644
index 0000000..d3dc05e
--- /dev/null
+++ b/etc/vdr/reccmds/reccmds.custom.conf
@@ -0,0 +1,8 @@
+# here you can insert your own commands for the commands
+# sub menue of a recording in vdr.
+#
+#Syntax:
+# title : command
+#
+#Example:
+# search ads : /usr/bin/noad nice
diff --git a/to_integrate/module-load b/to_integrate/module-load
new file mode 100644
index 0000000..c6919b4
--- /dev/null
+++ b/to_integrate/module-load
@@ -0,0 +1,10 @@
+load()
+{
+ /sbin/modprobe dvb-ttpci
+ /sbin/modprobe b2c2-flexcop-pci
+}
+
+unload()
+{
+ /sbin/rmmod dvb_ttpci b2c2_flexcop_pci b2c2_flexcop l64781 saa7146_vv saa7146 ves1820 tda8083 stv0297 sp8870 ves1x93 ttpci_eeprom skystar2 mt352 nxt2002 mt312 dvb_core stv0299
+}
diff --git a/to_integrate/vdr-start b/to_integrate/vdr-start
new file mode 100644
index 0000000..953c045
--- /dev/null
+++ b/to_integrate/vdr-start
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+source /etc/conf.d/vdr
+
diff --git a/to_integrate/vdrshutdown.sh b/to_integrate/vdrshutdown.sh
new file mode 100644
index 0000000..23ee6db
--- /dev/null
+++ b/to_integrate/vdrshutdown.sh
@@ -0,0 +1,152 @@
+#!/bin/bash
+# Author:
+# Matthias Schwarzott <zzam@gmx.de>
+# Various other contributors from gentoo.de
+#
+# some ideas from ctvdr's shutdownvdr by Tobias Grimm <tg@e-tobi.net>
+#
+
+# should be default paths on a machine build with vdr ebuilds
+SVDRPCMD=/usr/bin/svdrpsend.pl
+NVRAM_WAKEUP=/usr/bin/nvram-wakeup
+HOOKDIR=/etc/vdr/shutdown-hooks
+
+mesg() {
+ $SVDRPCMD MESG "\"$@\""
+}
+
+bg_retry() {
+ exec >/dev/null 2>/dev/null </dev/null
+ sleep ${1}m
+ $SVDRPCMD hitk power
+}
+
+EXITCODE=0
+MAX_TRY_AGAIN=0
+for HOOK in $HOOKDIR/shutdown-*.sh; do
+ TRY_AGAIN=0
+ [[ -f "${HOOK}" ]] && source "${HOOK}" $@
+
+ if [[ "${EXITCODE}" != "0" ]]; then
+ mesg "Shutdown aborted: ${ABORT_MESSAGE}"
+ exit 1
+ fi
+
+ if [[ $TRY_AGAIN -gt 0 ]]; then
+ if [ $MAX_TRY_AGAIN -lt $TRY_AGAIN ]; then
+ MAX_TRY_AGAIN=$TRY_AGAIN
+ fi
+ fi
+done
+
+if [ $MAX_TRY_AGAIN -gt 0 ]; then
+ bg_retry $MAX_TRY_AGAIN &
+ mesg "Retrying shutdown in $MAX_TRY_AGAIN minutes" &
+ exit 0
+fi
+
+# You have to edit sudo-permissions to grant vdr permission to execute
+# privileged commands. Start visudo and add a line like
+# vdr ALL= NOPASSWD: /usr/bin/nvram-wakeup, /sbin/shutdown
+# Add /sbin/lilo, /sbin/grub-set-default, /bin/mount, /usr/sbin/vdrshutdown-acpi.sh as needed
+SUDO=/usr/bin/sudo
+
+VDRSHUTDOWN_ACPI=/usr/sbin/vdrshutdown-acpi.sh
+[ -x /usr/bin/vdrshutdown-acpi.sh ] && VDRSHUTDOWN_ACPI=/usr/bin/vdrshutdown-acpi.sh
+
+# get some config stuff from vdr.shutdown
+
+NVRAM_CONFIG=$(grep -v "^#" /etc/conf.d/vdr.shutdown | grep NVRAM_CONFIG |cut -d "\"" -f 2)
+USE_NVRAM=$(grep -v "^#" /etc/conf.d/vdr.shutdown | grep USE_NVRAM |cut -d "\"" -f 2)
+USE_ACPI=$(grep -v "^#" /etc/conf.d/vdr.shutdown | grep USE_ACPI |cut -d "\"" -f 2)
+BOOT_MANAGER=$(grep -v "^#" /etc/conf.d/vdr.shutdown | grep BOOT_MANAGER |cut -d "\"" -f 2)
+REBOOT_ENTRY=$(grep -v "^#" /etc/conf.d/vdr.shutdown | grep REBOOT_ENTRY |cut -d "\"" -f 2)
+
+# does the check script exits?
+if [ -x ${CHECKSCRIPT} ]
+then
+ # run it
+ msg=$(${CHECKSCRIPT} "$@")
+ test "x${msg}" != "x" &&
+ {
+ $SVDRPCMD MESG $msg &
+ sleep 2
+ exit 1;
+ }
+fi
+
+# set the hardware clock to the current system time
+# ${SUDO} /sbin/hwclock --systohc
+
+# is nvram-wakeup installed?
+# does the config file exists?
+if [ -x ${NVRAM_WAKEUP} ] && [ "${USE_NVRAM}" = "yes" ]
+then
+
+ if [ "x${NVRAM_CONFIG}" != "x" ]
+ then
+ # set time - use also nvram config file
+ ${SUDO} ${NVRAM_WAKEUP} --syslog -C ${NVRAM_CONFIG} -s $1
+ else
+ # set time
+ ${SUDO} ${NVRAM_WAKEUP} --syslog -s $1
+ fi
+
+ # analyse
+ case $PIPESTATUS in
+ 0)
+ # all went ok - new date and time set
+ ${SUDO} /sbin/shutdown -h now
+ EXITSTATUS=0
+ ;;
+
+ 1)
+ # all went ok - new date and time set.
+ #
+ # *** but we need to reboot. ***
+ #
+ # for some boards this is needed after every change.
+ #
+ # for some other boards, we only need this after changing the
+ # status flag, i.e. from enabled to disabled or the other way.
+ # grub installed?
+ if [ "${BOOT_MANAGER}" = "grub" ]
+ then
+ if [ -x /sbin/grub-set-default ];
+ then
+ ${SUDO} /bin/mount /boot
+ ${SUDO} /sbin/grub-set-default ${REBOOT_ENTRY}
+ else
+ echo "Not supported - upgrade grub to latest _unstable_ version and it should work"
+ fi
+ else
+ # i hope it is lilo
+ ${SUDO} /sbin/lilo -R PowerOff
+ fi
+
+ ${SUDO} /sbin/shutdown -r now
+ EXITSTATUS=1
+ ;;
+
+ 2)
+ # something went wrong
+ # don't do anything - just exit with status 1
+ EXITSTATUS=1
+
+ echo "Something went wrong, please check your config files of nvram-wakeup"
+ ;;
+ esac
+
+ # exit with 0 if everything went ok.
+ # exit with 1 if something went wrong.
+ exit $EXITSTATUS
+
+# is acpi in kernel activated?
+elif [ -f /proc/acpi/alarm ] && [ "${USE_ACPI}" = "yes" ]
+then
+ ${SUDO} ${VDRSHUTDOWN_ACPI} $1
+ ${SUDO} /sbin/shutdown -h now
+else
+ # normal poweroff
+ ${SUDO} /sbin/shutdown -h now
+fi
diff --git a/usr/lib/vdr/rcscript/functions.sh b/usr/lib/vdr/rcscript/functions.sh
new file mode 100644
index 0000000..ac1e484
--- /dev/null
+++ b/usr/lib/vdr/rcscript/functions.sh
@@ -0,0 +1,137 @@
+
+test -z "${vdr_rcdir}" && vdr_rcdir=/usr/lib/vdr/rcscripts
+
+plugin_dir=/usr/lib/vdr/plugins
+test -d ${plugin_dir} || plugin_dir=/usr/lib/vdr
+
+pidof=/sbin/pidof
+test -x /bin/pidof && pidof=/bin/pidof
+
+test_vdr_process()
+{
+ ${pidof} /usr/bin/vdr >/dev/null
+}
+
+getvdrversion()
+{
+ vdrversion=$(awk '/VDRVERSION/ { gsub("\"","",$3); print $3 }' /usr/include/vdr/config.h)
+}
+
+init_params()
+{
+ # init array for parameters
+ opt_idx=0
+ unset vdropts
+ declare -a vdropts
+}
+
+add_param()
+{
+ vdropts[opt_idx]="$1"
+ opt_idx=$[opt_idx+1]
+}
+
+init_plugin_params()
+{
+ # init array for parameters
+ plugin_opt_idx=0
+ unset vdrplugin_opts
+ declare -a vdrplugin_opts
+}
+
+add_plugin_param()
+{
+ vdrplugin_opts[plugin_opt_idx]="$1"
+ plugin_opt_idx=$[plugin_opt_idx+1]
+}
+
+#
+# void load_addons_prefixed(char *prefix)
+#
+load_addons_prefixed()
+{
+ abort=0
+ for addon in ${vdr_rcdir}/${1}-*.sh; do
+ [[ -f "${addon}" ]] && source "${addon}"
+ [[ "$abort" != "0" ]] && break
+ done
+ return $abort
+}
+
+load_addon()
+{
+ [[ -f "${vdr_rcdir}/${1}.sh" ]] && source "${vdr_rcdir}/${1}.sh"
+ return $abort
+}
+
+load_plugin()
+{
+ local PLUGIN="${1}"
+ if [[ ! -f "${plugin_dir}/libvdr-${PLUGIN}.so.${vdrversion}" ]]; then
+ ewarn "Plugin ${PLUGIN} not found, starting without it."
+ return 1
+ fi
+
+ unset _EXTRAOPTS
+ if [[ -f /etc/conf.d/vdr.${PLUGIN} ]]; then
+ source /etc/conf.d/vdr.${PLUGIN}
+ fi
+ init_plugin_params ${PLUGIN}
+ add_plugin_param "--plugin=${PLUGIN}"
+ load_addon plugin-${PLUGIN}
+
+ add_param "${vdrplugin_opts[*]} ${_EXTRAOPTS}"
+}
+
+# int waitfor (int waittime, void (*condition)(void))
+# returns
+# 0 when condition returns true
+# 1 on timeout
+# 2 on other failure
+
+# condition should return
+# 0 for success
+# 1 for call later again
+# 2 failure, break waiting
+
+waitfor() {
+ local waittime="${1}"
+ local cond="${2}"
+ local ok
+ waited=0
+ while [[ "${waited}" -lt "${waittime}" ]]; do
+ eval ${cond}
+ case "$?" in
+ 0) einfo waited ${waited} seconds; return 0 ;;
+ 2) einfo waited ${waited} seconds; return 2 ;;
+ esac
+ waited=$[waited+1]
+ sleep 1
+ done
+ einfo waited ${waited} seconds
+ return 1
+}
+
+add_wait_condition() {
+ waitconditions="${waitconditions} ${1} "
+}
+
+wait_for_multiple_condition() {
+ ret=0
+ condition_msg=""
+ for cond in ${waitconditions}; do
+ eval ${cond}
+ case "$?" in
+ 0)
+ waitconditions=${waitconditions/${cond} /}
+ ;;
+ 1)
+ ret=1
+ ;;
+ 2)
+ return 2
+ ;;
+ esac
+ done
+ return $ret
+}
diff --git a/usr/lib/vdr/rcscript/post-start-50-svdrp.sh b/usr/lib/vdr/rcscript/post-start-50-svdrp.sh
new file mode 100644
index 0000000..cf7a758
--- /dev/null
+++ b/usr/lib/vdr/rcscript/post-start-50-svdrp.sh
@@ -0,0 +1,32 @@
+wait_for_svdrp() {
+ SVDRP_PORT="${SVDRP_PORT:-2001}"
+ [[ "${SVDRP_PORT}" == "0" ]] && return
+
+ # Warten auf offenen svdrp port
+ waitfor 20 svdrpready
+
+ case "$?" in
+ 1)
+ exit_msg="timeout"
+ abort=1
+ ;;
+ 2)
+ exit_msg="aborted, please check logfile"
+ abort=2
+ ;;
+ esac
+}
+
+svdrpready() {
+ if /usr/bin/svdrpsend.pl -d localhost -p ${SVDRP_PORT} quit 2>/dev/null|grep -q ^220; then
+ # svdrp open and ready
+ return 0
+ fi
+ if ! test_vdr_process; then
+ # Not running
+ return 2
+ fi
+ return 1
+}
+
+wait_for_svdrp
diff --git a/usr/lib/vdr/rcscript/pre-start-20-dvb-device.sh b/usr/lib/vdr/rcscript/pre-start-20-dvb-device.sh
new file mode 100644
index 0000000..af96f07
--- /dev/null
+++ b/usr/lib/vdr/rcscript/pre-start-20-dvb-device.sh
@@ -0,0 +1,9 @@
+check_dvbdevice() {
+ [[ -e /dev/dvb/adapter0/frontend0 ]] && return 0
+ condition_msg="dvb device not found"
+ return 1
+}
+
+if [ "$DEVICE_CHECK" != "disabled" ]; then
+ add_wait_condition check_dvbdevice
+fi
diff --git a/usr/lib/vdr/rcscript/pre-start-30-parameter.sh b/usr/lib/vdr/rcscript/pre-start-30-parameter.sh
new file mode 100644
index 0000000..0fd7428
--- /dev/null
+++ b/usr/lib/vdr/rcscript/pre-start-30-parameter.sh
@@ -0,0 +1,17 @@
+eval_standard_params() {
+ [ -n "${WATCHDOG}" ] && add_param "--watchdog=${WATCHDOG}"
+ [ -n "${AC3_AUDIO}" ] && add_param "--audio=${AC3_AUDIO}"
+ [ -n "${MUTE}" ] && add_param "--mute"
+ [ -n "${CONFIG}" ] && add_param "--config=${CONFIG}"
+ [ -n "${DEVICE}" ] && for i in ${DEVICE}; do add_param "--device=${i}"; done
+ [ -n "${EPGFILE}" ] && add_param "--epgfile=${EPGFILE}"
+ [ -n "${LOG}" ] && add_param "--log=${LOG}"
+ [ -n "${VIDEO}" ] && add_param "--video=${VIDEO}"
+ [ -n "${SVDRP_PORT}" ] && add_param "--port=${SVDRP_PORT}"
+
+ [ -n "${SHUTDOWN_HOOK}" ] && add_param "--shutdown=${SHUTDOWN_HOOK}"
+ [ -n "${RECORD_HOOK}" ] && add_param "--record=${RECORD_HOOK}"
+}
+
+
+eval_standard_params
diff --git a/usr/lib/vdr/rcscript/pre-start-40-create-commands-conf.sh b/usr/lib/vdr/rcscript/pre-start-40-create-commands-conf.sh
new file mode 100644
index 0000000..bb5c5cb
--- /dev/null
+++ b/usr/lib/vdr/rcscript/pre-start-40-create-commands-conf.sh
@@ -0,0 +1,43 @@
+create_commands_conf() {
+ local CONFIG="${CONFIG:-/etc/vdr}"
+ local bname="${1}"
+ local order="${2}"
+ local file="${CONFIG}/${bname}.conf"
+ local newfile="/var/vdr/${bname}.conf"
+ local sdir="/etc/vdr/${bname}"
+
+ if [[ ! -L "${file}" ]]; then
+ if [[ -f "${file}" ]]; then
+ mv "${file}" "${file}.backup"
+ einfo "Saved original ${file} as ${file}.backup"
+ fi
+
+ ln -s "../../${newfile}" "${file}"
+ fi
+
+ if ! rm "${newfile}"; then
+ ewarn "Could not change ${newfile}"
+ return
+ fi
+ cat > "${newfile}" <<-EOT
+ # Warning: Do not change this file.
+ # This file is generated automatically by /etc/init.d/vdr.
+ # Change the source files under ${sdir}.
+
+EOT
+ test -d "${sdir}" || return 1
+ SFILES=$(echo /etc/vdr/${bname}/${bname}.*.conf)
+ for f in ${SFILES}; do
+ [[ -f "${f}" ]] || continue
+ echo "# source : ${f}" >> "${newfile}"
+ cat "${f}" >> "${newfile}"
+ echo >> "${newfile}"
+ done
+}
+
+if [[ ! -d /var/vdr ]]; then
+ ewarn "directory /var/vdr does not exist"
+else
+ create_commands_conf commands "${ORDER_COMMANDS}"
+ create_commands_conf reccmds "${ORDER_RECCMDS}"
+fi
diff --git a/usr/lib/vdr/record-gate b/usr/lib/vdr/record-gate
new file mode 100644
index 0000000..05a7907
--- /dev/null
+++ b/usr/lib/vdr/record-gate
@@ -0,0 +1,2 @@
+#!/bin/bash
+
diff --git a/usr/sbin/vdr-watchdogd b/usr/sbin/vdr-watchdogd
new file mode 100755
index 0000000..4580bce
--- /dev/null
+++ b/usr/sbin/vdr-watchdogd
@@ -0,0 +1,41 @@
+#!/bin/bash
+#
+# Copyright 2003 Martin Hierling <mad@cc.fh-lippe.de>
+# Distributed under the GPL
+#
+# watchdog script to restart vdr after failure
+# to stop watchdog temporarily touch /tmp/nowatchdog
+#
+#
+
+#detach from terminal
+exec >/dev/null 2>/dev/null < /dev/null
+
+signal_stopped=0
+
+sig_usr1()
+{
+ signal_stopped=1
+ echo pausing watchdog
+}
+
+sig_usr2()
+{
+ signal_stopped=0
+ echo continuing watchdog
+}
+
+trap sig_usr1 SIGUSR1
+trap sig_usr2 SIGUSR2
+
+while sleep 8; do
+
+ [[ -f /tmp/no-vdr-watchdog ]] && continue
+
+ [[ "$signal_stopped" == "1" ]] && continue
+
+ if ! pidof /usr/bin/vdr > /dev/null; then
+ logger -i -t vdrwatchdog -p local0.info "initializing full VDR restart"
+ /etc/init.d/vdr fullrestart 2>&1 >/dev/null
+ fi
+done