#!/bin/sh

# Localisation
export TEXTDOMAINDIR="/usr/share/locale"
export TEXTDOMAIN=kanotix-vdr

DOWNLOAD="http://mitglied.lycos.de/peterweber69/vdr-xine"
WHAT="libxine1 xine-ui"

#DIALOG=Xdialog
DIALOG=dialog

INSTALLED=""
[ -d /KNOPPIX -o -d /KANOTIX ] || INSTALLED="yes"

if [ -z "$INSTALLED" ]; then
   if grep -q unionfs /proc/mounts; then
      echo Unionfs found.
   else
      echo Activating Unionfs now.
      mkdir -p /tmp/union
      UNION=/KNOPPIX
      [ -d /KANOTIX ] && UNION=/KANOTIX
      mount -t unionfs -o dirs=/tmp/union/:$UNION /none $UNION/ 2>&1 >/dev/null
   fi
fi

$DIALOG --title $"Installscript" --yesno \
$"When running this script, you need an active internet connection!\n\nProceed" 0 0
answer="$?"
[ "$answer" = 1 ] && exit 1
tput clear

echo $"VDR Update Start"

cd $HOME
rm -f vdr-update.sh
wget $DOWNLOAD/vdr-update.sh
chmod 755 vdr-update.sh
chown root.root vdr-update.sh
sh vdr-update.sh $WHAT

echo
echo
echo " >>> "$"Update done"" <<<"

echo 
echo $"Press any key" && read
