#!/bin/sh
echo ""
echo "mkbase start"
#chmod +x /usr/local/src/*/*/insmod.sh
chmod +x /usr/bin/*
chmod +x /usr/sbin/*
chmod +x /bin/*
chmod +x /sbin/*
rm /media/backup/back/easyvdr_base*.tar.bz2 > /dev/null 2>&1
rm -f /var/log/* > /dev/null 2>&1
rm -f /var/log/*/*  > /dev/null 2>&1
rm -f /var/log/*/*/* > /dev/null 2>&1
ln -s /var/log/everything/current /var/log/messages

mkdir /usr/local/share/doc/vdr > /dev/null 2>&1

rm -f /usr/local/share/doc/vdr/*README*
# create docs
cd /usr/local/src/VDR
for i in *READ* HISTORY MANUAL ; do
   cp -f $i /usr/local/share/doc/vdr/
done

cd /usr/local/src/VDR/PLUGINS/src

for i in */README ; do
   FN=$(echo ${i} | cut -f1 -d "/" | cut -f1 -d "-")
   cp -f $i /usr/local/share/doc/vdr/$FN.README
done

cd /

tar -cvjf /media/backup/easyvdr_base_usr.tar.bz2 \
    --exclude=./usr/local/src --exclude=./usr/src \
    --exclude=./usr/bin --exclude=./usr/sbin \
    --exclude=./lib/modules --exclude=./boot \
    --exclude=./usr/share --exclude=./usr/lib --exclude=./usr/vdr \
    --exclude=./usr/kde --exclude=./usr/X11R6 ./usr/*
    --exclude=./media --exclude=./video0
tar -cvjf /media/backup/easyvdr_base_ubin.tar.bz2 ./usr/bin ./usr/sbin


### Neu Kernel und VDR extra
tar -cvjf /media/backup/easyvdr_base_uvdr.tar.bz2 ./usr/vdr
tar -cvjf /media/backup/easyvdr_base_krnl.tar.bz2 ./lib/modules ./boot

    
tar -cvjf /media/backup/easyvdr_base_ushr.tar.bz2 ./usr/share \
  --exclude=./usr/share/tvmovie2vdr/downloadupdatefiles \
  --exclude=./usr/share/tvmovie2vdr/downloadfiles 
      
tar -cvjf /media/backup/easyvdr_base_ulib.tar.bz2 ./usr/lib

tar -cvjf /media/backup/easyvdr_base_var.tar.bz2 --exclude=./var/run/*/* --exclude=*.pid \
    --exclude=./var/cache/*/* --exclude=./var/cache/dhcpcd* --exclude=./var/lib/dhcpc/* \
    --exclude=./var/tmp/* ./var/*

tar -cvjf /media/backup/easyvdr_base.tar.bz2 --exclude=./_config --exclude=./dev/.d* \
    --exclude=./mnt/*/*  --exclude=./xsh --exclude=./xau --exclude=./tmp/* \
    --exclude=./proc/* --exclude=./etc/* --exclude=./root --exclude=./autorun.* \
    --exclude=./home/* --exclude=vdradmind.pid \
    --exclude=./video*/* --exclude=./pictures/* --exclude=./film/* --exclude=./audio/* \
    --exclude=./sys/* --exclude=./media/*/* --exclude=./opt/* --exclude=./media \
    --exclude=./tmpfs/* --exclude=./ShoutcastBrowser_Recently_Played \
    --exclude=./boot  --exclude=./lib/modules/* --exclude=./usr/* --exclude=./var/* ./*

echo "mkbase end"
echo ""
