0b3934849725d4282aac6610ae8fdb658028fe29
[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         # Kill any running instances of the daemon (only used on Linux based systems)
25         killall -q vicar-daemon || true
26         killall -q vicar-telepathy || true
27
28         echo "Starting Vicar daemon ..."
29         [[ -x /opt/vicar/vicar-daemon ]] && su - user -c "exec /opt/vicar/vicar-daemon& >/dev/null"
30
31         echo "Starting Vicar-Telepathy ..."
32         [[ -x /opt/vicar/vicar-telepathy ]] && su - user -c "exec /opt/vicar/vicar-telepathy& >/dev/null"
33
34         echo "Removing Vicar launch script..."
35         [[ -x /etc/event.d/launch-vicar ]] && rm -f /etc/event.d/launch-vicar
36
37         echo "Deleting previous release configuration from GConf ..."
38         gconftool-2 --unset /apps/Maemo/vicar/routing_enabled
39         gconftool-2 --unset /apps/Maemo/vicar/calling_card_number
40         gconftool-2 --unset /apps/Maemo/vicar/dtmf_delay
41         gconftool-2 --unset /apps/Maemo/vicar/numbers_to_exclude
42         gconftool-2 --unset /apps/Maemo/vicar/dtmf_format
43         gconftool-2 --unset /apps/Maemo/vicar/dtmf_prefix
44         gconftool-2 --unset /apps/Maemo/vicar/dtmf_suffix
45
46         echo "Creating Vicar Telepathy account ..."
47         [[ -x /opt/vicar/vicar-utils ]] && su - user -c "exec /opt/vicar/vicar-utils INSTALL"
48
49         echo "Updating permissions on Vicar DB file ..."
50         [[ -e /home/user/vicar.db.sqlite ]] && chown user:users /home/user/vicar.db.sqlite
51
52         echo "Creating Vicar Profiles database ..."
53         [[ -x /opt/vicar/vicar-utils ]] && su - user -c "exec /opt/vicar/vicar-utils CREATEDB"
54
55         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.
56
57          Please launch VICaR to setup routing profiles." uint32:0 string:"OK"
58
59     ;;
60
61     abort-upgrade|abort-remove|abort-deconfigure)
62     ;;
63
64     *)
65         echo "postinst called with unknown argument \`$1'" >&2
66         exit 1
67     ;;
68 esac
69
70 # dh_installdeb will replace this with shell code automatically
71 # generated by other debhelper scripts.
72
73 #DEBHELPER#
74
75 exit 0
76
77