#!/bin/sh
# postinst script for mscim-n900-ppinputmethod
#
# 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)
	if [ -d /home/user/.scim ]; 
	then
		rm -rf /home/user/.scim;
	fi
    ;;

    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.



exit 0



# Added by maemo-optify, with apologies.

optify () {
    f="$1"
    if [ ! -h "/$f" ]; then

        # This is not atomic, but re-startable: if interrupted, doing
        # this again will eventually finish with the correct result.
        #
        # XXX - At least that's the idea, but tar needs to be properly
        #       instructed to overwrite the targets.

        echo >&2 "Optifying $f -> /opt/maemo/$f"
        if [ -d "/$f" ]; then
            (cd "/" && tar cf - "$f") | (cd "/opt/maemo/" && tar xf -)
        fi
        mv "/$f" "/$f.removed"
        ln -s "/opt/maemo/$f" "/$f"
    fi

    if [ -e "/$f.removed" ]; then
        rm -rf "/$f.removed"
    fi
}

