#! /bin/sh -e

THEMEDIR='/usr/share/themes/blackplastictheme-themedir'

if [ ! -d $THEMEDIR ]; then
  exit 0
fi

	cp -rf /usr/share/themes/blackplastictheme-themedir/css  /usr/share/themes/blackplastictheme-themedir/variations/black/
	cp -rf /usr/share/themes/blackplastictheme-themedir/gtk-2.0  /usr/share/themes/blackplastictheme-themedir/variations/black/
	cp -rf /usr/share/themes/blackplastictheme-themedir/images  /usr/share/themes/blackplastictheme-themedir/variations/black/
	cp -rf /usr/share/themes/blackplastictheme-themedir/colors.config  /usr/share/themes/blackplastictheme-themedir/variations/black/
	cp -rf /usr/share/themes/blackplastictheme-themedir/transitions.tmp /usr/share/themes/blackplastictheme-themedir/transitions.ini

if [ -f /home/user/blackplasticsetup.sh ]; then

	rm -rf /home/user/blackplasticsetup.sh

fi

chmod a+x /opt/rx/setupblackplastic
gtk-update-icon-cache -f /usr/share/icons/hicolor
update-sudoers

 #/sbin/setupblackplastic

if [ "`readlink /etc/hildon/theme`" = /usr/share/themes/blackplastictheme-themedir ]; then
   if [ -x /usr/bin/personalisation ]; then
	   /usr/bin/personalisation /usr/share/themes/default
   fi
fi

rm -rf /usr/share/themes/blackplastictheme-themedir/gtk-2.0/*.cache
hildon-theme-cacher $THEMEDIR
