#!/bin/sh

mkdir -p /media/video0
mkdir -p /media/filme1
mkdir -p /media/filme2
mkdir -p /media/filme3
mkdir -p /media/mp3/tmp
mkdir -p /media/mp3/audiorecorder
mkdir -p /media/photos/vdr
mkdir -p /media/convert/dvd
mkdir -p /media/convert/divx
mkdir -p /media/convert/tmp
mkdir -p /media/convert/svcd
mkdir -p /media/convert/screenshot
mkdir -p /media/convert/mpg
mkdir -p /media/cdfs
mkdir -p /media/dvd
mkdir -p /media/cdrom
mkdir -p /data/games
mkdir -p /media/GameBoy
mkdir -p /media/usb
mkdir -p /media/updates
mkdir -p /media/updates/Online-Updates
mkdir -p /media/updates/Update-Prepare
mkdir -p /media/received_data
mkdir -p /var/cache/apt/archives/partial
mkdir -p /var/cache/xxv/preview
mkdir -p /var/cache/xxv/cover
mkdir -p /var/cache/xxv/tmp
mkdir -p /var/cache/podcatcher
mkdir -p /media/backup
mkdir -p /media/mp3/brennen

touch /var/cache/apt/archives/partial/.donotdelete
touch /media/GameBoy/.donotdelete
touch /media/convert/dvd/.donotdelete
touch /media/convert/screenshot/.donotdelete
touch /media/convert/mpg/.donotdelete
touch /media/convert/svcd/.donotdelete
touch /media/convert/divx/.donotdelete
touch /media/convert/tmp/.donotdelete
touch /media/filme1/.donotdelete
touch /media/dvd/.donotdelete
touch /media/cdrom/.donotdelete
touch /media/cdfs/.donotdelete
touch /media/filme2/.donotdelete
touch /media/filme3/.donotdelete
touch /media/mp3/tmp/.donotdelete
touch /media/photos/.donotdelete
touch /media/photos/vdr/.donotdelete
touch /media/usb/.donotdelete
touch /media/usb/stick/.donotdelete
touch /media/usb/card/.donotdelete
touch /media/usb/7in1/.donotdelete
touch /media/usb/camera/.donotdelete
touch /media/received_data/.donotdelete
touch /media/backup/.donotdelete
touch /var/cache/xxv/preview/.donotdelete
touch /var/cache/xxv/cover/.donotdelete
touch /var/cache/xxv/tmp/.donotdelete
touch /var/cache/podcatcher/.donotdelete
touch /media/mp3/brennen/.donotdelete

ln -s /etc/vdr/Network-Streams /media/mp3/Network-Streams

if [ ! -d /media/GameBoy ]; then
  ln -s  /media/GameBoy /data/games/GameBoy
fi

if [ ! -d /vtx ]; then
  ln -s  /ramdisk/vtx /vtx
fi

if [ ! -d /video0 ]; then
   ln -s /media/video0 /video0
fi

chgrp -R mysql /var/lib/mysql
chown -R mysql /var/lib/mysql
chgrp -R mysql /var/run/mysqld
chown -R mysql /var/run/mysqld

chmod 777 /tmp

mv /install.log /easyvdr_install.log

sleep 5

/usr/bin/easyvdr/easyvdr-config-imonvfd.sh
/usr/bin/easyvdr/easyvdr-config-vo.sh

