#!/bin/sh
TMP=/tmp/.set

echo "remove /mnt/settings/bouquets.*"
rm -f /mnt/settings/bouquets*
rm -f /mnt/settings/channel
rm -f /mnt/settings/provider
rm -f /mnt/settings/transponder
rm -f /mnt/settings/satellites
rm -f /mnt/settings/epgchannel

echo "successfully removed"
if [ `df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | head -n1 | wc -l` -eq 1 ]; then
	SPACE=`df | grep /dev/mtdblock | grep var | sed 's/ \+/ /g' | cut -d ' ' -f4 | head -n1`
	FREE=`expr $SPACE - 100`
	echo new freespace size $FREE kb
else
	echo "syncing disk"
	sync
fi

echo "restore default settings"
cp -a /etc/titan.restore/etc/titan/bouquets.* /mnt/settings 
cp -a /etc/titan.restore/etc/titan/channel /mnt/settings
cp -a /etc/titan.restore/etc/titan/provider /mnt/settings
cp -a /etc/titan.restore/etc/titan/satellites /mnt/settings
cp -a /etc/titan.restore/etc/titan/transponder /mnt/settings

touch /tmp/.tpk_needs_reboot
exit 0
