Package: im-config
Severity: important

This is a forward of the Ubuntu bug https://launchpad.net/bugs/1101836

The fix of http://bugs.debian.org/701181 meant inserting of a line of
code which prevents that /etc/X11/Xsession.d/80im-switch keeps being
sourced if the im-switch package is removed but not purged. This is
essential for im-config to work correctly.

However, if a user who has modified 80im-switch does not update before
replacing im-switch with im-config, 80im-switch will keep being sourced
and with that affect the im-config functionality adversely. One way to
prevent that from happening is to let im-config at installation insert a
line as just mentioned into 80im-switch, if it's not there already.
Attached please find a modified debian/postinst file which does just
that, and which we are about to use in Ubuntu.

-- 
Gunnar Hjalmarsson
https://launchpad.net/~gunnarhj
#!/bin/sh
# postinst script for im-config
# vim: set sts=4 expandtab:

set -e

# version just before wheezy release
# 4045a8eeb0e9226cdd9f8a121ccf4c04  80im-config_launch 0.3 (stable initial)
# 8a4829f935b5561ca6e61bec6eb3893f  80im-config_launch 0.3+squeeze1 (stable), 
0.4
# b243876a16f7b87c397ceef626098069  80im-config_launch 0.5
# 5ef27261ac38d704d8f766da19635461  80im-config_launch 0.6-0.17 (testing, 
unstable)

case "$1" in
    configure)
        IM_SWITCH_HOOK=/etc/X11/Xsession.d/80im-switch
        IM_SWITCH_DISABLE_CODE='[ -x /usr/bin/im-switch ] || return 0'
        if [ -f $IM_SWITCH_HOOK ] &&
         [ "$( head -1 $IM_SWITCH_HOOK )" != "$IM_SWITCH_DISABLE_CODE" ] &&
         [ "$( sed -n 15p $IM_SWITCH_HOOK )" != "$IM_SWITCH_DISABLE_CODE" ]
        then
            echo "Disabling conflicting hook file: $IM_SWITCH_HOOK ..."
            sed -i "1 i $IM_SWITCH_DISABLE_CODE" $IM_SWITCH_HOOK
        fi
        IM_CONFIG_HOOK=/etc/X11/Xsession.d/80im-config_launch
        if [ -f $IM_CONFIG_HOOK ]; then
            IM_CONFIG_HOOK_MD5SUM=$(md5sum < $IM_CONFIG_HOOK|cut -d ' ' -f 1)
            case $IM_CONFIG_HOOK_MD5SUM in
                
4045a8eeb0e9226cdd9f8a121ccf4c04|8a4829f935b5561ca6e61bec6eb3893f|b243876a16f7b87c397ceef626098069|5ef27261ac38d704d8f766da19635461)
                    rm -f $IM_CONFIG_HOOK
                ;;
    
                *)
                    echo "ERROR: Unknown hook file exists: $IM_CONFIG_HOOK." >&2
                ;;
            esac
        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.

#DEBHELPER#

exit 0

Reply via email to