summarylogtreecommitdiffstats
path: root/xp-pen-tablet.install
blob: 869f04e814493dc4cf3afb207576fdaffcfe4e62 (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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#! /bin/bash

pre_install()  {
AppName=PenTablet
pid=`ps -e|grep $AppName`
appScript=$AppName".sh"
if [ -n "$pid" ]; then
	echo $pid
	arr=()
	while read -r line; do
	   arr+=("$line")
	done <<< "$pid"
	for val in "${arr[@]}";
	do
		appid=`echo $val | awk '{print $1}'`
	   	name=`echo $val | awk '{print $4}'`
	   	echo "ID:"$appid 
		echo "Name:"$name
		if [ "$name" = "$appRunScript" ]; then
			echo "close $appRunScript"
			kill -15 $appid
		elif [ "$name" = "$AppName" ]; then
			echo "close $AppName"
			kill -15 $appid
		fi
	done
fi
}

post_install() {
appDir=/usr/lib/pentablet
confPath=$appDir/conf/xppen
libPath=$appDir/lib
platPath=$appDir/platforms
RuleDir="/usr/lib/udev/rules.d"
ruleName="10-xp-pen.rules"

chmod +0755 /usr/share/applications/xppentablet.desktop
chmod +0644 /usr/share/icons/hicolor/256x256/apps/xppentablet.png

chmod +0755 $appDir/PenTablet
chmod +0755 $appDir/PenTablet.sh
#chmod +0666 $appDir/resource.rcc #not exist in this version


# chmod +0777 $confPath #Move to package()
# chmod +0777 $libPath
# chmod +0777 $platPath

chmod +0666 $confPath/config.xml
chmod +0666 $confPath/language.ini
chmod +0666 $confPath/name_config.ini

chmod +0666 $libPath/libicudata.so.56
chmod +0666 $libPath/libicui18n.so.56
chmod +0666 $libPath/libicuuc.so.56
chmod +0666 $libPath/libQt5Core.so.5
chmod +0666 $libPath/libQt5DBus.so.5
chmod +0666 $libPath/libQt5Gui.so.5
chmod +0666 $libPath/libQt5Network.so.5
chmod +0666 $libPath/libQt5Widgets.so.5
chmod +0666 $libPath/libQt5X11Extras.so.5
chmod +0666 $libPath/libQt5XcbQpa.so.5
chmod +0666 $libPath/libQt5Xml.so.5

chmod +0666 $platPath/libqxcb.so

lockfile="/tmp/qtsingleapp-Pentab-9c9b-lockfile"
touch $lockfile
chmod +0666 $lockfile

# Checking and applying the udev rule 
if [ -f "$RuleDir/$ruleName" ]; then
	udevadm control --reload-rules && udevadm trigger
fi

#Removing autostart scripts as the systemd service is now used.
if [ -f "/etc/xdg/autostart/pentablet.desktop" ] || [ -f "/etc/xdg/autostart/xppentablet.desktop" ]; then
	rm -f /etc/xdg/autostart/ugee-pentablet.desktop;
	rm -f /etc/xdg/autostart/pentablet.desktop;
	rm -f /etc/xdg/autostart/xppentablet.desktop
fi

#Reload daemon
systemctl daemon-reload 

cat <<EOF

********************"
installation successful!

to restart the xp-pen driver, please run:
systemctl --user restart xppentablet.service

if you want the driver to autostart, please run:
systemctl --user enable xppentablet.service

********************"

EOF
}

pre_upgrade() {
pre_install
}
post_upgrade() {
post_install
}
pre_remove () {
 pre_install
 lockfile="/tmp/qtsingleapp-Pentab-9c9b-lockfile"
 rm $lockfile
 #Remove service
 systemctl --global disable xppentablet.service
 }
 post_remove(){
 echo "Uninstall succeeded."
 }