aboutsummaryrefslogtreecommitdiffstats
path: root/main/clamav/APKBUILD
blob: 0f7ff73b91e4dbefcfa5eeb922ccdf74c4df2cef (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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
pkgname=clamav
pkgver=0.98.6
pkgrel=1
pkgusers="clamav"
pkggroups="clamav"
pkgdesc="An anti-virus toolkit for UNIX"
url="http://www.clamav.net/"
arch="all"
license="GPL2"
depends="$pkgname-scanner $pkgname-daemon"
install="freshclam.pre-install
	clamav-daemon.pre-install clamav-daemon.pre-upgrade"
makedepends="ncurses-dev zlib-dev bzip2-dev openssl-dev linux-headers"
subpackages="$pkgname-doc $pkgname-dev $pkgname-lib $pkgname-libunrar
	$pkgname-daemon $pkgname-scanner $pkgname-db freshclam"
source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz

	clamd.initd
	clamd.confd
	freshclam.initd
	freshclam.confd
	clamd.logrotate
	freshclam.logrotate
	"

_builddir="$srcdir/$pkgname-$pkgver"

prepare() {
	local i
	cd "$_builddir"
	update_config_sub || return 1
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	cd "$_builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--libdir=/usr/lib \
		--sysconfdir=/etc/clamav \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--without-iconv \
		--disable-llvm \
		--with-user=clamav \
		--with-group=clamav \
		--with-dbdir=/var/lib/clamav \
		--enable-clamdtop \
		--enable-bigstack \
		|| return 1
	make || return 1
}

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install || return 1
	rm "$pkgdir"/usr/lib/*.la || return 1

	# set proper defaults
	sed -i -e "s:^\(Example\):\# \1:" \
                -e "s:.*\(PidFile\) .*:\1 /var/run/clamav/freshclam.pid:" \
                -e "s:.*\(DatabaseOwner\) .*:\1 clamav:" \
                -e "s:^\#\(UpdateLogFile\) .*:\1 /var/log/clamav/freshclam.log:" \
                -e "s:^\#\(NotifyClamd\).*:\1 /etc/clamav/clamd.conf:" \
                -e "s:^\#\(ScriptedUpdates\).*:\1 yes:" \
                -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
                "$pkgdir"/etc/clamav/freshclam.conf.sample

	# set proper defaults
        sed -i -e "s:^\(Example\):\# \1:" \
                -e "s:.*\(PidFile\) .*:\1 /var/run/clamav/clamd.pid:" \
                -e "s:.*\(LocalSocket\) .*:\1 /var/run/clamav/clamd.sock:" \
                -e "s:.*\(User\) .*:\1 clamav:" \
                -e "s:^\#\(LogFile\) .*:\1 /var/log/clamav/clamd.log:" \
                -e "s:^\#\(LogTime\).*:\1 yes:" \
               -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
                "$pkgdir"/etc/clamav/clamd.conf.sample
}

lib() {
	pkgdesc="ClamAV library"
	depends=""
	replaces="clamav"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libclamav.so.* \
		"$subpkgdir"/usr/lib/
}

libunrar() {
	pkgdesc="ClamAV unrar libraries"
	depends=""
	replaces="clamav"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libclamunrar* \
		"$subpkgdir"/usr/lib/
}

freshclam() {
	pkgdesc="Auto-updater for the Clam Antivirus scanner data-files"
	depends="logrotate"
	replaces="clamav clamav-db"
	mkdir -p "$subpkgdir"/usr/bin \
		"$subpkgdir"/etc/init.d \
		"$subpkgdir"/etc/conf.d \
		"$subpkgdir"/etc/clamav

        mv "$pkgdir"/usr/bin/freshclam "$subpkgdir"/usr/bin || return 1
        mv "$pkgdir"/etc/clamav/freshclam.conf.sample \
		"$subpkgdir"/etc/clamav/ || return 1
	install -d -m755 -o clamav -g clamav \
                "$subpkgdir"/var/run/clamav \
		"$subpkgdir"/var/log/clamav \
		"$subpkgdir"/var/lib/clamav || return 1

	install -m755 -D "$srcdir"/freshclam.initd \
		"$subpkgdir"/etc/init.d/freshclam || return 1
        install -m644 -D "$srcdir"/freshclam.confd \
		"$subpkgdir"/etc/conf.d/freshclam || return 1
	install -m644 -D "$srcdir"/freshclam.logrotate \
		"$pkgdir"/etc/logrotate.d/freshclam || return 1
}

db() {
	pkgdesc="ClamAV dummy package for compatibility"
	replaces="clamav"
	depends="freshclam"
	mkdir -p "$subpkgdir"/var/lib/ \
		"$subpkgdir"/usr/bin \
		"$subpkgdir"/etc/clamav \
		|| return 1
	install -d -m755 -o clamav -g clamav \
                "$subpkgdir"/var/run/clamav \
		"$subpkgdir"/var/log/clamav \
		"$subpkgdir"/var/lib/clamav || return 1
}

scanner() {
	pkgdesc="ClamAV command-line scanner and utils"
	replaces="clamav"
	depends="freshclam"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/clamscan \
		"$subpkgdir"/usr/bin/ || return 1
	mv "$pkgdir"/usr/bin/sigtool \
		"$subpkgdir"/usr/bin/ || return 1
	mv "$pkgdir"/usr/bin/clambc \
		"$subpkgdir"/usr/bin/ || return 1
}

daemon() {
	pkgdesc="ClamAV daemon scanner"
	replaces="clamav"
	depends="freshclam logrotate"
        mkdir -p "$subpkgdir"/usr/bin \
		"$subpkgdir"/usr/sbin \
		"$subpkgdir"/etc/clamav \
		|| return 1
	install -d -m 755 -o clamav -g clamav \
                "$subpkgdir"/var/run/clamav \
		"$subpkgdir"/var/log/clamav \
		"$subpkgdir"/var/lib/clamav
	mv "$pkgdir"/usr/bin/clamconf \
		"$subpkgdir"/usr/bin/ || return 1
	mv "$pkgdir"/usr/sbin/clamd \
		"$subpkgdir"/usr/sbin/ || return 1
	mv "$pkgdir"/usr/bin/clamdtop \
		"$subpkgdir"/usr/bin/ || return 1
	mv "$pkgdir"/usr/bin/clamdscan \
		"$subpkgdir"/usr/bin/ || return 1
	mv "$pkgdir"/etc/clamav/clamd.conf.sample \
		"$subpkgdir"/etc/clamav/ || return 1
        install -m755 -D "$srcdir"/clamd.initd \
		"$subpkgdir"/etc/init.d/clamd || return 1
        install -m644 -D "$srcdir"/clamd.confd \
		"$subpkgdir"/etc/conf.d/clamd || return 1
        install -m644 -D "$srcdir"/clamd.logrotate \
		"$pkgdir"/etc/logrotate.d/clamd || return 1
}

md5sums="7f4f7e82a09e42c4ebf153d6d452d9d8  clamav-0.98.6.tar.gz
9b8163aebbfe87bcc0a91c14f364b3e0  clamd.initd
e8a03fad6ce603631e8fe71a24d387c6  clamd.confd
d29c888953097041f27b2dbc21b6e94c  freshclam.initd
e48466ddfb56f66c623b83e58777b778  freshclam.confd
ae1e48ab56a0fff1acdde023c1f6f350  clamd.logrotate
226824214c021b2366f0be1289561d17  freshclam.logrotate"
sha256sums="6591245d55445a2ddcc1700964c33b8bf62fe20c75bd9c7746f4fe0735502951  clamav-0.98.6.tar.gz
7563924ac0f7cc44fc4982c67efb26c42b162aab65ce7efad2b875bd44a1cc8a  clamd.initd
4d978313004f66d871564b873df27c5459d3cc504788b179e41edba0f04b74dc  clamd.confd
cf945febd186528798df2e5567e108d1bcf3618c74615d8c5edee3cfad756c9c  freshclam.initd
75551ce7e04bbef4a889bc94a357b160d9da88f06eba32df594ba3cbb2c81ed1  freshclam.confd
ec5e60f7efca02ed151f625e9a44404346991ed6608c6e2088db2436bbd03d49  clamd.logrotate
84006ac3d2e8dc2e13a01f5e313c20e4978cdc93d831c181e0075badcbf4ada0  freshclam.logrotate"
sha512sums="420064e784c352c1398c531f7530dbe37ed1092de8015984b354a96f0e5fe0968b285cae6108659fcebfa91ffbe0742335b70cb8d7f49db7690d049ca2d52758  clamav-0.98.6.tar.gz
6ea6eb24d255703d5107191d078d77c576128eef552fb0c39ac97a2c975d714428de5844912c6145254de887d26c616cdcd904321c5bbec98b0cc8c1d3fcbb46  clamd.initd
59c561b3dcb0b616b647cd8e4ebc46a2cc5e7144c8c7ea0054cc1c3021d1da8f67e4dad5c083c3fe712ed887aaabfca91b538f4759537e7c4c9ab71ba4fd5794  clamd.confd
7371e12ce6efa33684ac90a03c244b2cf626322ac8fc1e9fa8ca67a9353badea3f3eb0b3d966e286519956f94d1b5752b3d03aabb901105270010eadb0aedf72  freshclam.initd
ba181fe1abaac7b898ccb40b0713455aa3c9d5e25ad21d687b6cac09b0105b9e376526e7c776a44636234d8db819709d8d6a6cc76119bc3e98b637b1a3f26c08  freshclam.confd
57e5b0c0dc6dc078e0102829e5d36882cff9ae5dd0637c31c7a23ef274dd0a4d967bc036f74c42b4690af511bc0a43fdb6d19b0c307506432577d82de7beff78  clamd.logrotate
f1cd8df6d47824009a6df130bd60bf5e9f9deaef87fbeaceec8fe71e6c8b2772b5dba017390a2190deee851723256f06e9aef2182b0a2881119f22ba68740554  freshclam.logrotate"