summarylogtreecommitdiffstats
path: root/trueconf-client.install
blob: f74ed362b48870116540e3bbeaba1e82541e9415 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
cmd_present() {
	command -v "$1" >/dev/null 2>&1
}

pre_install() {
	echo ""
}

post_install() {
  	BASE_TC_PATH="/opt/trueconf"
	STARTUP_SCRIPT="${BASE_TC_PATH}/trueconf-client"
	AUTORUN_SCRIPT="${BASE_TC_PATH}/trueconf-client-autostart"

	chmod a+x ${STARTUP_SCRIPT}
	chmod a+x ${AUTORUN_SCRIPT}	

	LINK_FILE="/usr/bin/trueconf"
	if [ -f ${LINK_FILE} ]; then
		rm ${LINK_FILE}
	fi
	if [ ! -f ${LINK_FILE} ]; then
		ln -s -f ${STARTUP_SCRIPT} ${LINK_FILE}
	fi

	if cmd_present "gconftool-2"; then
		gconftool-2 -s /desktop/gnome/url-handlers/visicall/command '/opt/trueconf/trueconf-client %s' --type String
		gconftool-2 -s /desktop/gnome/url-handlers/visicall/enabled --type Boolean true
		
		gconftool-2 -s /desktop/gnome/url-handlers/trueconf/command '/opt/trueconf/trueconf-client %s' --type String
		gconftool-2 -s /desktop/gnome/url-handlers/trueconf/enabled --type Boolean true
	fi

	if cmd_present "xdg-desktop-menu"; then
		xdg-desktop-menu install --novendor --mode system /opt/trueconf/trueconf.desktop
		xdg-desktop-menu forceupdate --mode system
	else
		echo "WARNING: Could not find xdg-desktop-menu" >&2
	fi

	if cmd_present "kbuildsycoca4"; then
		kbuildsycoca4 --noincremental
	fi

	if cmd_present "appstreamcli"; then
		appstreamcli refresh
	fi

	pid=$(ps axco pid,command | awk '$2 == "TrueConf" {print $1; }')
	if [ -n "$pid" ]; then
		for process in "$pid"; do
				kill -s 50 $process 
		done
	fi
}

pre_upgrade() {
	echo ""
}

post_upgrade() {
	post_install
}

pre_remove() {    
	if cmd_present 'xdg-desktop-menu'; then
	    xdg-desktop-menu uninstall --novendor --mode system /opt/trueconf/trueconf.desktop
	    xdg-desktop-menu forceupdate --mode system
	else
	    echo "WARNING: Could not find xdg-desktop-menu" >&2
	fi
	autostart_dir="${HOME}/.config/autostart"
	if [ -f ${autostart_dir}/trueconf.desktop ]; then
	    rm ${autostart_dir}/trueconf.desktop
	fi
	if [ -f ${autostart_dir}/trueconf-autostart.desktop ]; then
	    rm ${autostart_dir}/trueconf-autostart.desktop
	fi
}

post_remove() {	
  	LINK_FILE="/usr/bin/trueconf"
  	if [ -f ${LINK_FILE} ]; then
  	    rm ${LINK_FILE}
  	fi
}