#!/bin/bash
#
source /etc/conf.d/vdr.admin.cfg

if [ "$1" != "" ] ; then
   REC=$1
else
   REC=`$GETVAL RCV`
fi

sed -i /etc/vdr/setup.conf -e "s/SetSystemTime.*/SetSystemTime = 1/"
if [ "$REC" = "SAT" ] ; then
   sed -i /etc/vdr/setup.conf -e "s/TimeTransponder.*/TimeTransponder = 111837/"
   if [ "`grep -c \":S19\.2E:\" /etc/vdr/channels.conf`" = "0" ] ; then
      cp -f /etc/vdr/channels.conf.sat /etc/vdr/channels.conf
   fi

   if [ "$1" != "" ] ; then
      $SETVAL RCV SAT
   fi
else
   if [ "$REC" = "Kabel" ]  ; then
      sed -i /etc/vdr/setup.conf -e "s/TimeTransponder.*/TimeTransponder = 410/"
      if [ "`grep -c \":M64:\" /etc/vdr/channels.conf`" = "0" ] ; then
         cp -f /etc/vdr/channels.conf.cable /etc/vdr/channels.conf
      fi

      if [ "$1" != "" ] ; then
         $SETVAL RCV Kabel
      fi
   else
      echo "Unknown parameter $1"
      exit 1
   fi
fi
echo 'Done!'
exit 0
