Depend on libosso-dev instead of libdbus-1-dev for the plugin
[browser-switch] / debian / postrm
1 #!/bin/sh
2 # postrm script for browser-switchboard
3 #
4 # see: dh_installdeb(1)
5
6 set -e
7
8 # summary of how this script can be called:
9 #        * <postrm> `remove'
10 #        * <postrm> `purge'
11 #        * <old-postrm> `upgrade' <new-version>
12 #        * <new-postrm> `failed-upgrade' <old-version>
13 #        * <new-postrm> `abort-install'
14 #        * <new-postrm> `abort-install' <old-version>
15 #        * <new-postrm> `abort-upgrade' <old-version>
16 #        * <disappearer's-postrm> `disappear' <overwriter>
17 #          <overwriter-version>
18 # for details, see http://www.debian.org/doc/debian-policy/ or
19 # the debian-policy package
20
21 kill_old_proxies() {
22         # Kill off old python browser-switchboards, if any
23         # This would be so much nicer with pgrep/pkill ...
24         proxy_pids=`busybox ps | fgrep "python /usr/bin/browser-switchboard" | fgrep -v grep | awk '{ print $1 }'`
25         if [ ! -z "$proxy_pids" ]; then
26                 kill $proxy_pids
27         fi
28         # Kill off C browser-switchboards
29         proxy_pids=`pidof browser-switchboard || true`
30         if [ ! -z "$proxy_pids" ]; then
31                 kill $proxy_pids
32         fi
33 }
34
35 case "$1" in
36     remove)
37         dpkg-divert --remove --package browser-switchboard --rename \
38             --divert /usr/bin/browser.tablet-browser-ui \
39             /usr/bin/browser
40         dpkg-divert --remove --package browser-switchboard --rename \
41             --divert /usr/share/dbus-1/services/com.nokia.osso_browser.tablet-browser-ui \
42             /usr/share/dbus-1/services/com.nokia.osso_browser.service
43         # Try to make dbus-daemon pick up the change in services file
44         kill -HUP `pidof dbus-daemon`
45
46         # Kill off any running browser-switchboard to make sure that the
47         # default browser gets launched
48         kill_old_proxies
49         ;;
50     upgrade|disappear)
51         # Kill off any running browser-switchboard to make sure that the new
52         # version gets launched the next time a D-Bus request is made
53         kill_old_proxies
54         ;;
55     purge|failed-upgrade|abort-install|abort-upgrade)
56     ;;
57
58     *)
59         echo "postrm called with unknown argument \`$1'" >&2
60         exit 1
61     ;;
62 esac
63
64 # dh_installdeb will replace this with shell code automatically
65 # generated by other debhelper scripts.
66
67 #DEBHELPER#
68
69 exit 0
70
71