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

LILO_CONF="/etc/lilo.conf"
VESA="video=vesafb:.*"
VESA_OFF="video=vesafb:off\""
VESA_ON="video=vesafb:ywrap,mtrr,800x600-16@60\""
VESA_ON_SPLASH="video=vesafb:ywrap,mtrr,800x600-16@60 splash=silent,theme:vdr quiet CONSOLE=/dev/tty1\""

#read-only
#initrd = /boot/fbsplash-vdr-800x600

logger -s "ADMIN - Framebuffer: $VESAFB"

if [ "$VESAFB" = "1" ] ; then
   if [ "$BOOTSPLASH" = "1" ] ; then
      sed -i $LILO_CONF -e "s/$VESA.*/$VESA_ON_SPLASH/" \
                        -e "s/^#initrd/initrd/"
   else
      sed -i $LILO_CONF -e "s/$VESA.*/$VESA_ON/" \
                        -e "s/^initrd/#initrd/"
   fi
   logger -s "ADMIN - BootSplash: $VESAFB"
else
   sed -i $LILO_CONF -e "s/$VESA.*/$VESA_OFF/" \
                     -e "s/^initrd/#initrd/"
fi
lilo
echo 'Done!'
exit 0

