#!/bin/bash

# vdrd: a simple script, similar tu runvdr, for starting vdr
#       with the desired options (driver reloading is ignored!)
#
# Written and copyright by Patrick Cernko <errror@gmx.de>

# set vdrdir to the path, where you installed vdr
vdrdir=/opt/vdr

# make sure vdr binaries are in search path
PATH=$vdrdir/bin:$PATH

# mak sure, VDR variable is set reasonable
VDR=vdr

# read vdr command line configuration
. $vdrdir/bin/vdrargs.sh

# run loop
while true; do
    # run $VDR with the arguments from vdrargs.sh
    # and the QUOTED plugin-array-variable
    $VDR $VDR_ARGS "${VDR_PLUGIN[@]}"
    # until vdr's exit code signals to exit
    if test $? -eq 0 -o $? -eq 2; then 
        exit
    fi
done
