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

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

ALL_VARS=$(grep "^/etc" $ADMIN_CFG_FILE | cut -f 2 -d ":" | grep -v "^PLG_")

for i in $ALL_VARS ; do
   VAL=$(grep -m 1 "^$i=" $VDR_CONF | cut -f 2 -d '"')
   $SETVAL $i "$VAL"
done

# And now the Plugins
#set -x
USE_PLG=$(grep "^PLUGINS=" $VDR_CONF |cut -f 2 -d '"')
PLG_SCR="$ADMIN_SCRIPT_PATH/cfgplg.sh"
sh $PLG_SCR "$USE_PLG"

# search for updates
sh $ADMIN_SCRIPT_PATH/cfgupd.sh -check

#find all remote controls
LIRC=$($GETVAL LIRC)
ALL_CONF=$(ls /_config/install/lircd.conf.*| cut -f 3 -d ".")
ALL_LIRC="Tastatur"
for i in $ALL_CONF ; do
   ALL_LIRC="$ALL_LIRC,$i"
done
#set -x
sed -i $ADMIN_CFG_FILE -e "s/\:LIRC\:.*/\:LIRC\:0\:L\:0\:${ALL_LIRC},Nexus,Other\:Tastatur\/Fernbedienung\:/"
$SETVAL LIRC $LIRC     
exit 0

