summarylogtreecommitdiffstats
path: root/canon-pixma-mx870-complete.install
blob: 67f142e9818c6b6b3542ee61f6e59c9b9e1b19cd (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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
## Built with assistance from debtap --> https://aur.archlinux.org/packages/debtap/

post_install() {
## cnijfilter-mx870series section
	gtk-update-icon-cache -q -t -f /usr/share/icons/hicolor

	CNIJ_PKG_INFO=cnijfilter-mx870-367

	model_name=$(echo ${CNIJ_PKG_INFO} | cut -d- -f2)
	model_num=$(echo ${CNIJ_PKG_INFO} | cut -d- -f3)

	_cups_path1=/usr/share/ppd
	_cups_path2=/usr/share/cups/model
	ppd_name=canon${model_name}.ppd

	if [ -x /usr/bin/ldconfig ]; then
		/sbin/ldconfig
	fi

	# Make symbolic link for the ppd file
	if [ ! -d ${_cups_path2} ]; then
		mkdir ${_cups_path2}
	fi
	ln -fs ${_cups_path1}/${ppd_name} ${_cups_path2}/${ppd_name}
	update-desktop-database -q

	
## scangearmp-common section
	gtk-update-icon-cache -q -t -f /usr/share/icons/hicolor

	_gimp2dir1=/usr/lib32/gimp/2.0/plug-ins
	_gimp2dir2=/usr/lib/gimp/2.0/plug-ins

	if [ -x /usr/bin/ldconfig ]; then
		/sbin/ldconfig
	fi

	# Make symbolic link for GIMP-plug-in
	if [ -d ${_gimp2dir1} ]; then
		ln -fs /usr/bin/scangearmp ${_gimp2dir1}/scangearmp
	elif [ -d ${_gimp2dir2} ]; then
		ln -fs /usr/bin/scangearmp ${_gimp2dir2}/scangearmp
	fi

	# Reload udev rules
	if [ -x /usr/bin/udevadm ]; then
		/sbin/udevadm control --reload-rules 2> /dev/null
		/sbin/udevadm trigger --action=add --subsystem-match=usb 2> /dev/null
	fi

	update-desktop-database -q
}

post_upgrade() {
	post_install
}

post_remove() {
## cnijfilter-common section
	if [ -x /usr/bin/ldconfig ]; then
		/sbin/ldconfig
	fi

	# Remove cnbp* libs
	for LIBS in libcnnet; do
		if [ -h /usr/lib/${LIBS}.so ]; then
			unlink /usr/lib/${LIBS}.so
		fi	
	done
	if [ "$1" = 0 ]; then
		rmdir -p --ignore-fail-on-non-empty /usr/lib/bjlib
	fi


## cnijfilter-mx870series section
	gtk-update-icon-cache -q -t -f /usr/share/icons/hicolor

	CNIJ_PKG_INFO=cnijfilter-mx870-367

	model_name=$(echo ${CNIJ_PKG_INFO} | cut -d- -f2)
	model_num=$(echo ${CNIJ_PKG_INFO} | cut -d- -f3)

	_cups_path2=/usr/share/cups/model
	ppd_name=canon${model_name}.ppd

	if [ -x /usr/bin/ldconfig ]; then
		/sbin/ldconfig
	fi

	# Remove cnbp* libs
	for LIBS in libcnbpcmcm libcnbpcnclapi libcnbpcnclbjcmd libcnbpcnclui libcnbpess libcnbpo; do
		if [ -h /usr/lib/${LIBS}${model_num}.so ]; then
			unlink /usr/lib/${LIBS}${model_num}.so
		fi	
	done

	# Remove directories
	if [ "$1" = 0 ] ; then
		rmdir -p --ignore-fail-on-non-empty /usr/share/locale/*/LC_MESSAGES
		rmdir -p --ignore-fail-on-non-empty /usr/share/cngpijmon${model_name}
		rmdir -p --ignore-fail-on-non-empty /usr/share/printui${model_name}
	fi

	# Remove symbolic link for ppd
	unlink ${_cups_path2}/${ppd_name}
	update-desktop-database -q

	
## scangearmp-common section
	gtk-update-icon-cache -q -t -f /usr/share/icons/hicolor

	_gimp2dir1=/usr/lib32/gimp/2.0/plug-ins
	_gimp2dir2=/usr/lib/gimp/2.0/plug-ins

	for LIBS in libcncpmsimg libcncpmslld libcncpcmcm libcncpmsui libcncpnet
	do
		if [ -h /usr/lib/${LIBS}.so ]; then
			unlink /usr/lib/${LIBS}.so
		fi	
	done

	# Remove symbolic link for GIMP-plug-in
	if [ -d ${_gimp2dir1} ]; then
		unlink ${_gimp2dir1}/scangearmp	
	elif [ -d ${_gimp2dir2} ]; then
		unlink ${_gimp2dir2}/scangearmp
	fi

	# Remove sgmp_setting files
	rm -f /tmp/canon_sgmp_setting*.*
	update-desktop-database -q

	
## scangearmp-mx870series section
	SCAN_PKG_INFO=scangearmp-870-367

	model_num=$(echo ${SCAN_PKG_INFO} | cut -d- -f3)

	if [ -x /usr/bin/ldconfig ]; then
		/sbin/ldconfig
	fi

	# Remove cncp* libs
	for LIBS in libcncpmsimg libcncpmslld; do
		if [ -h /usr/lib/${LIBS}${model_num}.so ]; then
			unlink /usr/lib/${LIBS}${model_num}.so
		fi	
		if [ -h /usr/lib/${LIBS}${model_num}c.so ]; then
			unlink /usr/lib/${LIBS}${model_num}c.so
		fi	
	done

	# Remove .desktop file and icon
	if [ -f /usr/share/applications/canon-pixma-mx870-complete-scangearmp.desktop ]; then
		rm -f /usr/share/applications/canon-pixma-mx870-complete-scangearmp.desktop
	fi
	if [ -f /usr/share/pixmaps/canon-pixma-mx870-complete-scangearmp-icon.png ]; then
		rm -f /usr/share/pixmaps/canon-pixma-mx870-complete-scangearmp-icon.png
	fi
}