APKBUILD 7.13 KB
Newer Older
1
# Contributor: Valery Kartel <valery.kartel@gmail.com>
2
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
3 4
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
Carlo Landmeter's avatar
Carlo Landmeter committed
5
pkgname=clamav
6
pkgver=0.100.0
7
pkgrel=1
8 9
pkgusers="clamav"
pkggroups="clamav"
10
pkgdesc="An anti-virus toolkit for UNIX eis-ng backport"
Carlo Landmeter's avatar
Carlo Landmeter committed
11
url="http://www.clamav.net/"
12
arch="all"
13
license="GPL-2.0"
14
depends="$pkgname-scanner $pkgname-daemon"
15
depends_dev="libressl-dev"
16 17
install="freshclam.pre-install
	clamav-daemon.pre-install clamav-daemon.pre-upgrade"
Carlo Landmeter's avatar
Carlo Landmeter committed
18 19
makedepends="ncurses-dev zlib-dev bzip2-dev pcre-dev linux-headers $depends_dev
	libmilter-dev fts-dev"
20
subpackages="$pkgname-doc $pkgname-dev $pkgname-lib $pkgname-libunrar
Carlo Landmeter's avatar
Carlo Landmeter committed
21
	$pkgname-daemon $pkgname-scanner $pkgname-db::noarch freshclam
Ariadne Conill's avatar
Ariadne Conill committed
22
	$pkgname-daemon-openrc:daemon_rc:noarch freshclam-openrc:freshclam_rc:noarch
Carlo Landmeter's avatar
Carlo Landmeter committed
23
	$pkgname-milter"
24
source="http://www.clamav.net/downloads/production/$pkgname-$pkgver.tar.gz
25 26 27 28
	clamd.initd
	clamd.confd
	freshclam.initd
	freshclam.confd
29 30
	clamd.logrotate
	freshclam.logrotate
31 32

	0001-libclamav-explicitly-use-top_srcdir-.git-dir.patch
33
	"
Carlo Landmeter's avatar
Carlo Landmeter committed
34

Carlo Landmeter's avatar
Carlo Landmeter committed
35
builddir="$srcdir/$pkgname-$pkgver"
Carlo Landmeter's avatar
Carlo Landmeter committed
36

TBK's avatar
TBK committed
37
# secfixes:
38 39 40 41 42 43
#   0.99.4-r0:
#     - CVE-2012-6706
#     - CVE-2017-6419
#     - CVE-2017-11423
#     - CVE-2018-0202
#     - CVE-2018-1000085
TBK's avatar
TBK committed
44 45 46 47 48 49 50 51 52
#   0.99.3-r0:
#     - CVE-2017-12374
#     - CVE-2017-12375
#     - CVE-2017-12376
#     - CVE-2017-12377
#     - CVE-2017-12378
#     - CVE-2017-12379
#     - CVE-2017-12380

53
prepare() {
Carlo Landmeter's avatar
Carlo Landmeter committed
54 55
	update_config_sub
	default_prepare
56 57
}

Carlo Landmeter's avatar
Carlo Landmeter committed
58
build() {
Carlo Landmeter's avatar
Carlo Landmeter committed
59
	cd "$builddir"
60
	LIBS=-lfts ./configure \
61 62 63
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
64
		--libdir=/usr/lib \
65
		--sysconfdir=/etc/clamav \
Carlo Landmeter's avatar
Carlo Landmeter committed
66 67
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
Carlo Landmeter's avatar
Carlo Landmeter committed
68
		--without-iconv \
69
		--disable-llvm \
70 71
		--with-user=clamav \
		--with-group=clamav \
72
		--with-dbdir=/var/lib/clamav \
73
		--enable-clamdtop \
74
		--enable-bigstack \
75
		--with-pcre \
Carlo Landmeter's avatar
Carlo Landmeter committed
76 77
		--enable-milter
	make
Carlo Landmeter's avatar
Carlo Landmeter committed
78 79
}

80 81 82 83 84
check() {
	cd "$builddir"
	make check
}

Carlo Landmeter's avatar
Carlo Landmeter committed
85
package() {
Carlo Landmeter's avatar
Carlo Landmeter committed
86 87
	cd "$builddir"
	make DESTDIR="$pkgdir" install
88

89
	# set proper defaults
90
	sed -i -e "s:^\(Example\):\# \1:" \
91 92 93 94 95 96 97
		-e "s:.*\(PidFile\) .*:\1 /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
98 99

	# set proper defaults
100 101 102 103 104 105 106 107
	sed -i -e "s:^\(Example\):\# \1:" \
		-e "s:.*\(PidFile\) .*:\1 /run/clamav/clamd.pid:" \
		-e "s:.*\(LocalSocket\) .*:\1 /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
108
}
Carlo Landmeter's avatar
Carlo Landmeter committed
109

Carlo Landmeter's avatar
Carlo Landmeter committed
110 111 112 113 114
check() {
	cd "$builddir"
	make check
}

115 116
lib() {
	pkgdesc="ClamAV library"
117
	replaces="clamav"
118
	depends=
119 120 121 122
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libclamav.so.* \
		"$subpkgdir"/usr/lib/
}
123

124 125
libunrar() {
	pkgdesc="ClamAV unrar libraries"
126
	replaces="clamav"
127
	depends=
128 129 130 131 132
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libclamunrar* \
		"$subpkgdir"/usr/lib/
}

133 134 135
freshclam() {
	pkgdesc="Auto-updater for the Clam Antivirus scanner data-files"
	replaces="clamav clamav-db"
136
	depends=
137
	mkdir -p "$subpkgdir"/usr/bin \
138
		"$subpkgdir"/etc/clamav
139

140 141
	mv "$pkgdir"/usr/bin/freshclam "$subpkgdir"/usr/bin
	mv "$pkgdir"/etc/clamav/freshclam.conf.sample \
Carlo Landmeter's avatar
Carlo Landmeter committed
142 143
		"$subpkgdir"/etc/clamav/freshclam.conf

144 145
	install -d -m755 -o clamav -g clamav \
		"$subpkgdir"/var/log/clamav \
Carlo Landmeter's avatar
Carlo Landmeter committed
146
		"$subpkgdir"/var/lib/clamav
147

148 149 150 151 152 153 154 155
	install -m644 -D "$srcdir"/freshclam.logrotate \
		"$subpkgdir"/etc/logrotate.d/freshclam
}

freshclam_rc() {
	pkgdesc="Auto-updater for the Clam Antivirus scanner data-files (OpenRC init scripts)"
	install_if="freshclam=$pkgver-r$pkgrel openrc"
	replaces="clamav freshclam"
156
	depends=
157 158 159
	mkdir -p "$subpkgdir"/etc/init.d \
		"$subpkgdir"/etc/conf.d

160
	install -m755 -D "$srcdir"/freshclam.initd \
Carlo Landmeter's avatar
Carlo Landmeter committed
161 162 163
		"$subpkgdir"/etc/init.d/freshclam
	install -m644 -D "$srcdir"/freshclam.confd \
		"$subpkgdir"/etc/conf.d/freshclam
164 165 166
}

db() {
167
	pkgdesc="ClamAV dummy package for compatibility"
168
	replaces="clamav"
169
	depends="freshclam"
170 171
	mkdir -p "$subpkgdir"/var/lib/ \
		"$subpkgdir"/usr/bin \
Carlo Landmeter's avatar
Carlo Landmeter committed
172
		"$subpkgdir"/etc/clamav
173 174
	install -d -m755 -o clamav -g clamav \
		"$subpkgdir"/var/log/clamav \
Carlo Landmeter's avatar
Carlo Landmeter committed
175
		"$subpkgdir"/var/lib/clamav
176
}
177

178 179
scanner() {
	pkgdesc="ClamAV command-line scanner and utils"
180
	replaces="clamav"
181
	depends="freshclam"
182 183
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/clamscan \
Carlo Landmeter's avatar
Carlo Landmeter committed
184
		"$subpkgdir"/usr/bin/
185
	mv "$pkgdir"/usr/bin/sigtool \
Carlo Landmeter's avatar
Carlo Landmeter committed
186
		"$subpkgdir"/usr/bin/
187
	mv "$pkgdir"/usr/bin/clambc \
Carlo Landmeter's avatar
Carlo Landmeter committed
188
		"$subpkgdir"/usr/bin/
Carlo Landmeter's avatar
Carlo Landmeter committed
189 190
}

191 192
daemon() {
	pkgdesc="ClamAV daemon scanner"
193
	replaces="clamav"
194 195
	depends="freshclam"
	mkdir -p "$subpkgdir"/usr/bin \
196
		"$subpkgdir"/usr/sbin \
Carlo Landmeter's avatar
Carlo Landmeter committed
197
		"$subpkgdir"/etc/clamav
198 199 200
	install -d -m 755 -o clamav -g clamav \
		"$subpkgdir"/var/log/clamav \
		"$subpkgdir"/var/lib/clamav
201
	mv "$pkgdir"/usr/bin/clamconf \
Carlo Landmeter's avatar
Carlo Landmeter committed
202
		"$subpkgdir"/usr/bin/
203
	mv "$pkgdir"/usr/sbin/clamd \
Carlo Landmeter's avatar
Carlo Landmeter committed
204
		"$subpkgdir"/usr/sbin/
205
	mv "$pkgdir"/usr/bin/clamdtop \
Carlo Landmeter's avatar
Carlo Landmeter committed
206
		"$subpkgdir"/usr/bin/
207
	mv "$pkgdir"/usr/bin/clamdscan \
Carlo Landmeter's avatar
Carlo Landmeter committed
208
		"$subpkgdir"/usr/bin/
209
	mv "$pkgdir"/etc/clamav/clamd.conf.sample \
Carlo Landmeter's avatar
Carlo Landmeter committed
210
		"$subpkgdir"/etc/clamav/clamd.conf
211 212 213 214 215 216 217 218 219 220
	install -m644 -D "$srcdir"/clamd.logrotate \
		"$subpkgdir"/etc/logrotate.d/clamd
}

daemon_rc() {
	pkgdesc="ClamAV anti-virus scanner daemon (OpenRC init scripts)"
	replaces="clamav"
	depends="freshclam-openrc"
	install_if="$pkgname-daemon=$pkgver-r$pkgrel openrc"

Carlo Landmeter's avatar
Carlo Landmeter committed
221 222 223 224 225 226 227 228
	install -m755 -D "$srcdir"/clamd.initd \
		"$subpkgdir"/etc/init.d/clamd
	install -m644 -D "$srcdir"/clamd.confd \
		"$subpkgdir"/etc/conf.d/clamd
}

milter() {
	pkgdesc="ClamAV milter"
229
	depends=
Carlo Landmeter's avatar
Carlo Landmeter committed
230 231 232 233 234 235
	mkdir -p "$subpkgdir"/usr/sbin \
		"$subpkgdir"/etc/clamav
	mv "$pkgdir"/usr/sbin/clamav-milter \
		"$subpkgdir"/usr/sbin/
	mv "$pkgdir"/etc/clamav/clamav-milter.conf.sample \
		"$subpkgdir"/etc/clamav/clamav-milter.conf
236
}
237

238
sha512sums="57e1da86a32fdfb66887c4aeed03008bc070ce3cb6b881db411332f2f2e640b73dca84d990f5886526b3d6bd0c2770c7dcce5b4e7cf48323824c362452593549  clamav-0.100.0.tar.gz
239
ed81be79bf9a25eec071312252121cc76c96838407377b75077bf94922055f1de99f327982ac4dccd5be85003baa95385e5d002fabab32bb851bb30178475edd  clamd.initd
Natanael Copa's avatar
Natanael Copa committed
240
59c561b3dcb0b616b647cd8e4ebc46a2cc5e7144c8c7ea0054cc1c3021d1da8f67e4dad5c083c3fe712ed887aaabfca91b538f4759537e7c4c9ab71ba4fd5794  clamd.confd
241
00daed8afb67a6e4a29893340246c8840cce970dd9103d26557ecdd26ef60b12551d2291c214fc657faaaa339484052079347411b0cad65e3a33ece56d57cf16  freshclam.initd
Natanael Copa's avatar
Natanael Copa committed
242
ba181fe1abaac7b898ccb40b0713455aa3c9d5e25ad21d687b6cac09b0105b9e376526e7c776a44636234d8db819709d8d6a6cc76119bc3e98b637b1a3f26c08  freshclam.confd
243
3ae493dd1610a819402c015f6b8c0f080f926b72dc43d2bded60030bf6a55040e4b88e0f64d3aae299dc1133d7e1b89855e7346b4665a64e8b82592f7b75cf6a  clamd.logrotate
244 245
30cff378bc28c76b795e00c92ae5ee623f3abe4a19bed61dd8403c96e72658bb02b7f040d26a6258104af754464d25ea7d9646918c4b47d2ba9a8cbf4687056c  freshclam.logrotate
7eeac468d1e2bc6fde8d1e4cbe0b7fad646d41798fe860718bf0a8ed6026920222daae125804a58f8add02487bf9c9e72a618f87441b20782910668915c99a75  0001-libclamav-explicitly-use-top_srcdir-.git-dir.patch"