summarylogtreecommitdiffstats
path: root/canon-pixma-mx870-complete.install
blob: d5f34c85f105852c536983d2abe2835ce63ea8f9 (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
## Built with assistance from debtap --> https://aur.archlinux.org/packages/debtap/

post_install() {
## cnijfilter-mx870series section

	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 /sbin/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}
	
## scangearmp-common section

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

	# 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

}

post_upgrade() {
	post_install
}

post_remove() {
## cnijfilter-common section

	if [ -x /sbin/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

	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

	# 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}

	
## scangearmp-common section

	_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*.*

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

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

	# 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

}