#!/bin/sh
# postinst script for isearch-edit
#
# 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>
#        * <postinst> `abort-remove'
#        * <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


case "$1" in
    configure)
    	# only call maemo-select-menu-location if the package was not
	    # installed before
	    if [ -z $2 ]; then
		    maemo-select-menu-location isearch-edit.desktop
	    fi

        MIS_DIR="/usr/share/mis"
        if [ -e $MIS_DIR ]; then
	        chown root:users $MIS_DIR -R || true
	        chmod g+w $MIS_DIR -R || true
        fi

	    LOGO_DIR="/home/user/MyDocs/.images/Internet-Search-Logos"
	    if [ -e "/home/user" ] && [ ! -e ${LOGO_DIR} ]; then
            mkdir -p ${LOGO_DIR} || true
	    fi

	    [ ! -e ${LOGO_DIR}/Google.png ] && ln -s /usr/share/icons/hicolor/scalable/hildon/qgn_indi_search_google.png ${LOGO_DIR}/Google.png || true
	    [ ! -e ${LOGO_DIR}/Wikipedia.png ] && ln -s /usr/share/icons/hicolor/scalable/hildon/qgn_indi_search_wikipedia.png ${LOGO_DIR}/Wikipedia.png || true
	
	    chown user:users ${LOGO_DIR} -R || true

        # force update of the icon cache for the application icon to show up properly
        gtk-update-icon-cache -f /usr/share/icons/hicolor
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

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

#DEBHELPER#

exit 0

