. /etc/init.d/tc-functions

if [ "`getBuild`" == "x86" ]; then
 LIBDIR="i386-linux-gnu"
elif [ "`getBuild`" == "armv7" ]; then
 LIBDIR=arm-linux-gnueabihf
elif [ "`getBuild`" == "x86_64" ]; then
 LIBDIR=x86_64-linux-gnu
fi

if [ -d /tmp/tcloop/APPNAME/ ]; then
   rm /usr/bin/enlightenment_start 
   /bb/cp /tmp/tcloop/APPNAME/usr/bin/enlightenment_start /usr/bin/

   rm -r /usr/lib/"$LIBDIR"/enlightenment/modules/*
   /bb/cp -a /tmp/tcloop/APPNAME/usr/lib/"$LIBDIR"/enlightenment/modules/* /usr/lib/"$LIBDIR"/enlightenment/modules/

   rm -r /usr/lib/"$LIBDIR"/enlightenment/utils/*
   /bb/cp -a /tmp/tcloop/APPNAME/usr/lib/"$LIBDIR"/enlightenment/utils/* /usr/lib/"$LIBDIR"/enlightenment/utils/
fi

[ -z /etc/sysconfig/desktop ] || echo "enlightenment_start" > /etc/sysconfig/desktop