#!/bin/sh
if ! test -d /var/etc; then
	ln -sf /etc /var/etc
fi

if ! test -d /var/tuxbox; then
	ln -sf /etc/tuxbox /var/tuxbox
fi

if ! test -d /usr/share/enigma2/Gemini_default; then
	ln -sf /usr/lib/enigma2/python/Plugins/Bp/geminimain/images /usr/share/enigma2/Gemini_default
fi

if ! test -d /usr/lib/enigma2/python/Plugins/Bp/geminimain/images/buttons; then
	ln -sf /usr/share/enigma2/skin_default/buttons /usr/lib/enigma2/python/Plugins/Bp/geminimain/images/buttons
fi

if ! test -d /etc/enigma2/gemini_user_desktop; then
	mkdir -p /etc/enigma2/gemini_user_desktop
fi

if [ -f /etc/enigma2/gemini_bak/externAddonFilterList.py ]
then
	cp -a /etc/enigma2/gemini_bak/externAddonFilterList.py /usr/lib/enigma2/python/Plugins/Bp/geminimain/externAddonFilterList.py
fi

cd /
if [ -f /etc/enigma2/gemini_bak/gemini-plugin.tar.gz ]
then
	tar xzvf /etc/enigma2/gemini_bak/gemini-plugin.tar.gz >/dev/null 2>&1
fi

for FILE in /etc/enigma2/gemini_*.xml ; do
	WEATHER=`cat $FILE | grep gweather -c`
	if [ $WEATHER != 0 ];
	then
		ginstall.py remove '("", "", "", "", "Plugins.Bp.geminimain.gweather", "", "", "", "", "")' path=$FILE
	fi
done

if [ x"$D" = "x" ]; then
	if [ -x /sbin/ldconfig ]; then /sbin/ldconfig ; fi
fi
