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

VDR_CONF="/etc/conf.d/vdr"

ALL_VARS=`grep "^$0" $ADMIN_CFG_FILE | cut -f 2 -d ":"`

for i in $ALL_VARS ; do
   VAL=`$GETVAL ${i}`
   echo "${i}:${VAL}"
   VE=`grep "^${i}=" $VDR_CONF`
   if [ "$VE" = "" ] ; then
      echo "Adding ${i}=\"${VAL}\" to $VDR_CONF"
      echo "${i}=\"${VAL}\"" >> $VDR_CONF
   else
      echo "Changing ${i}=\"${VAL}\" in $VDR_CONF"
      sed -i $VDR_CONF -e "s/^${i}=.*/${i}=\"${VAL}\"/"
   fi
done
echo 'Done!'
exit 0

