#!/bin/sh
# postinst script for slim
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
#


# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#Variables

#init file
#slim="/etc/init.d/slim"

#load init script
#init=`cat $slim`

#search tag for sed (inotify daemon)
#tag="while read line; do \/usr\/bin\/update_slim_wmlist; done"

#aplay command for sed
#aplay="aplay \/usr\/share\/sounds\/mintfb-slim.wav &"

#check for aplay in init
#check=`echo $init | grep "aplay"`
#THIS REALLY SHOULD CHECK IF APLAY IS PRESENT IN SLIM FILE. TO BE FIXED
#check=
#/Variables


#Add line for system sound
#if [ "$check" = "" ]
#then
#	echo "Adding system sound"
#	sed "/$tag/a $aplay" $slim > /tmp/slim-init
#	cat /tmp/slim-init > $slim
#	rm /tmp/slim-init
#else
#	echo "An aplay command already exists"
#fi

#make sure it is executable
#chmod +x $slim

#created link for default slim theme    
if [  -L /usr/share/slim/themes/conf-default ]; then
   rm -f /usr/share/slim/themes/conf-default
       cd /usr/share/slim/themes
        ln -s ../themes/mint-lxde  /usr/share/slim/themes/conf-default
else
       cd /usr/share/slim/themes
        ln -s ../themes/mint-lxde  /usr/share/slim/themes/conf-default
fi

exit 0
