Fix for publish/subscribe error
[vicar] / debian / postinst
1 #!/bin/sh
2 # postinst script for vicar
3 #
4 # see: dh_installdeb(1)
5
6 set -e
7
8 # summary of how this script can be called:
9 #        * <postinst> `configure' <most-recently-configured-version>
10 #        * <old-postinst> `abort-upgrade' <new version>
11 #        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
12 #          <new-version>
13 #        * <postinst> `abort-remove'
14 #        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
15 #          <failed-install-package> <version> `removing'
16 #          <conflicting-package> <version>
17 # for details, see http://www.debian.org/doc/debian-policy/ or
18 # the debian-policy package
19
20
21 case "$1" in
22     configure)
23
24         eval $(dbus-launch --sh-syntax)
25         export DBUS_SESSION_BUS_ADDRESS
26         export DBUS_SESSION_BUS_PID
27
28         # Kill any running instances of the daemon (only used on Linux based systems)
29         killall -q vicar-daemon || true
30         killall -q vicar-telepathy || true
31
32         echo "Starting Vicar daemon ..."
33         [[ -x /opt/vicar/vicar-daemon ]] && su - user -c "exec /opt/vicar/vicar-daemon& >/dev/null"
34
35         echo "Starting Vicar-Telepathy ..."
36         [[ -x /opt/vicar/vicar-telepathy ]] && su - user -c "exec /opt/vicar/vicar-telepathy& >/dev/null"
37
38         echo "Removing Vicar launch script..."
39         [[ -x /etc/event.d/launch-vicar ]] && rm -f /etc/event.d/launch-vicar
40
41         echo "Deleting previous release configuration from GConf ..."
42         gconftool-2 --unset /apps/Maemo/vicar/routing_enabled
43         gconftool-2 --unset /apps/Maemo/vicar/calling_card_number
44         gconftool-2 --unset /apps/Maemo/vicar/dtmf_delay
45         gconftool-2 --unset /apps/Maemo/vicar/numbers_to_exclude
46         gconftool-2 --unset /apps/Maemo/vicar/dtmf_format
47         gconftool-2 --unset /apps/Maemo/vicar/dtmf_prefix
48         gconftool-2 --unset /apps/Maemo/vicar/dtmf_suffix
49
50         echo "Creating Vicar Telepathy account ..."
51         [[ -x /opt/vicar/vicar-utils ]] && su - user -c "exec /opt/vicar/vicar-utils INSTALL"
52
53         echo "Updating permissions on Vicar DB file ..."
54         [[ -e /home/user/vicar.db.sqlite ]] && chown user:users /home/user/vicar.db.sqlite
55
56         echo "Creating Vicar Profiles database ..."
57         [[ -x /opt/vicar/vicar-utils ]] && su - user -c "exec /opt/vicar/vicar-utils CREATEDB"
58
59         dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteDialog         string:"Starting with this release, Multiple profiles can be created for routing calls via VICaR.
60
61          Please launch VICaR to setup routing profiles." uint32:0 string:"OK"
62
63     ;;
64
65     abort-upgrade|abort-remove|abort-deconfigure)
66     ;;
67
68     *)
69         echo "postinst called with unknown argument \`$1'" >&2
70         exit 1
71     ;;
72 esac
73
74 # dh_installdeb will replace this with shell code automatically
75 # generated by other debhelper scripts.
76
77 #DEBHELPER#
78
79 exit 0
80
81