APKBUILD 6.65 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.3
7
pkgrel=0
8 9
pkgusers="clamav"
pkggroups="clamav"
10
pkgdesc="An anti-virus toolkit for UNIX eis-ng backport"
11
url="https://www.clamav.net/"
12
arch="all"
13
license="GPL2"
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 22
	$pkgname-daemon $pkgname-scanner $pkgname-db::noarch freshclam
	$pkgname-milter"
23
source="http://www.clamav.net/downloads/production/$pkgname-$pkgver.tar.gz
24 25 26 27
	clamd.initd
	clamd.confd
	freshclam.initd
	freshclam.confd
28 29
	clamd.logrotate
	freshclam.logrotate
30
	"
Carlo Landmeter's avatar
Carlo Landmeter committed
31
builddir="$srcdir/$pkgname-$pkgver"
Carlo Landmeter's avatar
Carlo Landmeter committed
32

33
# secfixes:
34 35 36 37
#   0.100.3-r0:
#     - CVE-2019-1787
#     - CVE-2019-1788
#     - CVE-2019-1789
38 39 40 41 42
#   0.100.2-r0:
#     - CVE-2018-15378
#     - CVE-2018-14680
#     - CVE-2018-14681
#     - CVE-2018-14682
43 44 45 46
#   0.100.1-r0:
#     - CVE-2017-16932
#     - CVE-2018-0360
#     - CVE-2018-0361
47 48 49 50
#   0.99.4-r0:
#     - CVE-2018-0202
#     - CVE-2018-1000085

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

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

package() {
Carlo Landmeter's avatar
Carlo Landmeter committed
79 80
	cd "$builddir"
	make DESTDIR="$pkgdir" install
81

82
	# set proper defaults
83
	sed -i -e "s:^\(Example\):\# \1:" \
84
                -e "s:.*\(PidFile\) .*:\1 /run/clamav/freshclam.pid:" \
85 86 87 88 89
                -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:" \
90
                "$pkgdir"/etc/clamav/freshclam.conf.sample
91 92 93

	# set proper defaults
        sed -i -e "s:^\(Example\):\# \1:" \
94 95
                -e "s:.*\(PidFile\) .*:\1 /run/clamav/clamd.pid:" \
                -e "s:.*\(LocalSocket\) .*:\1 /run/clamav/clamd.sock:" \
96 97 98 99
                -e "s:.*\(User\) .*:\1 clamav:" \
                -e "s:^\#\(LogFile\) .*:\1 /var/log/clamav/clamd.log:" \
                -e "s:^\#\(LogTime\).*:\1 yes:" \
               -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
100
                "$pkgdir"/etc/clamav/clamd.conf.sample
101
}
Carlo Landmeter's avatar
Carlo Landmeter committed
102

Carlo Landmeter's avatar
Carlo Landmeter committed
103 104 105 106 107
check() {
	cd "$builddir"
	make check
}

108 109 110
lib() {
	pkgdesc="ClamAV library"
	depends=""
111
	replaces="clamav"
112 113 114 115
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libclamav.so.* \
		"$subpkgdir"/usr/lib/
}
116

117 118 119
libunrar() {
	pkgdesc="ClamAV unrar libraries"
	depends=""
120
	replaces="clamav"
121 122 123 124 125
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libclamunrar* \
		"$subpkgdir"/usr/lib/
}

126 127
freshclam() {
	pkgdesc="Auto-updater for the Clam Antivirus scanner data-files"
128
	depends="logrotate"
129 130 131 132
	replaces="clamav clamav-db"
	mkdir -p "$subpkgdir"/usr/bin \
		"$subpkgdir"/etc/init.d \
		"$subpkgdir"/etc/conf.d \
Carlo Landmeter's avatar
Carlo Landmeter committed
133
		"$subpkgdir"/etc/clamav \
134

Carlo Landmeter's avatar
Carlo Landmeter committed
135
        mv "$pkgdir"/usr/bin/freshclam "$subpkgdir"/usr/bin
136
        mv "$pkgdir"/etc/clamav/freshclam.conf.sample \
Carlo Landmeter's avatar
Carlo Landmeter committed
137 138
		"$subpkgdir"/etc/clamav/freshclam.conf

139 140
	install -d -m755 -o clamav -g clamav \
		"$subpkgdir"/var/log/clamav \
Carlo Landmeter's avatar
Carlo Landmeter committed
141
		"$subpkgdir"/var/lib/clamav
142 143

	install -m755 -D "$srcdir"/freshclam.initd \
Carlo Landmeter's avatar
Carlo Landmeter committed
144 145 146
		"$subpkgdir"/etc/init.d/freshclam
	install -m644 -D "$srcdir"/freshclam.confd \
		"$subpkgdir"/etc/conf.d/freshclam
147
	install -m644 -D "$srcdir"/freshclam.logrotate \
Carlo Landmeter's avatar
Carlo Landmeter committed
148
		"$subpkgdir"/etc/logrotate.d/freshclam
149 150 151
}

db() {
152
	pkgdesc="ClamAV dummy package for compatibility"
153
	replaces="clamav"
154
	depends="freshclam"
155 156
	mkdir -p "$subpkgdir"/var/lib/ \
		"$subpkgdir"/usr/bin \
Carlo Landmeter's avatar
Carlo Landmeter committed
157
		"$subpkgdir"/etc/clamav
158 159
	install -d -m755 -o clamav -g clamav \
		"$subpkgdir"/var/log/clamav \
Carlo Landmeter's avatar
Carlo Landmeter committed
160
		"$subpkgdir"/var/lib/clamav
161
}
162

163 164
scanner() {
	pkgdesc="ClamAV command-line scanner and utils"
165
	replaces="clamav"
166
	depends="freshclam"
167 168
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/clamscan \
Carlo Landmeter's avatar
Carlo Landmeter committed
169
		"$subpkgdir"/usr/bin/
170
	mv "$pkgdir"/usr/bin/sigtool \
Carlo Landmeter's avatar
Carlo Landmeter committed
171
		"$subpkgdir"/usr/bin/
172
	mv "$pkgdir"/usr/bin/clambc \
Carlo Landmeter's avatar
Carlo Landmeter committed
173
		"$subpkgdir"/usr/bin/
Carlo Landmeter's avatar
Carlo Landmeter committed
174 175
}

176 177
daemon() {
	pkgdesc="ClamAV daemon scanner"
178
	replaces="clamav"
179
	depends="freshclam logrotate"
180 181
        mkdir -p "$subpkgdir"/usr/bin \
		"$subpkgdir"/usr/sbin \
Carlo Landmeter's avatar
Carlo Landmeter committed
182
		"$subpkgdir"/etc/clamav
183 184 185
	install -d -m 755 -o clamav -g clamav \
		"$subpkgdir"/var/log/clamav \
		"$subpkgdir"/var/lib/clamav
186
	mv "$pkgdir"/usr/bin/clamconf \
Carlo Landmeter's avatar
Carlo Landmeter committed
187
		"$subpkgdir"/usr/bin/
188
	mv "$pkgdir"/usr/sbin/clamd \
Carlo Landmeter's avatar
Carlo Landmeter committed
189
		"$subpkgdir"/usr/sbin/
190
	mv "$pkgdir"/usr/bin/clamdtop \
Carlo Landmeter's avatar
Carlo Landmeter committed
191
		"$subpkgdir"/usr/bin/
192
	mv "$pkgdir"/usr/bin/clamdscan \
Carlo Landmeter's avatar
Carlo Landmeter committed
193
		"$subpkgdir"/usr/bin/
194
	mv "$pkgdir"/etc/clamav/clamd.conf.sample \
Carlo Landmeter's avatar
Carlo Landmeter committed
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
		"$subpkgdir"/etc/clamav/clamd.conf
	install -m755 -D "$srcdir"/clamd.initd \
		"$subpkgdir"/etc/init.d/clamd
	install -m644 -D "$srcdir"/clamd.confd \
		"$subpkgdir"/etc/conf.d/clamd
	install -m644 -D "$srcdir"/clamd.logrotate \
		"$subpkgdir"/etc/logrotate.d/clamd
}

milter() {
	pkgdesc="ClamAV milter"
	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
212
}
213

214
sha512sums="948bb7538233d01533c9ce9a2fc0bec2d7b45924759dd6280cf8e853dcb6d2a443f2bdaafeb9d45170456fdc06485b462bf01c3bd69767423fba5a75f05415e0  clamav-0.100.3.tar.gz
215
ed81be79bf9a25eec071312252121cc76c96838407377b75077bf94922055f1de99f327982ac4dccd5be85003baa95385e5d002fabab32bb851bb30178475edd  clamd.initd
Natanael Copa's avatar
Natanael Copa committed
216
59c561b3dcb0b616b647cd8e4ebc46a2cc5e7144c8c7ea0054cc1c3021d1da8f67e4dad5c083c3fe712ed887aaabfca91b538f4759537e7c4c9ab71ba4fd5794  clamd.confd
217
00daed8afb67a6e4a29893340246c8840cce970dd9103d26557ecdd26ef60b12551d2291c214fc657faaaa339484052079347411b0cad65e3a33ece56d57cf16  freshclam.initd
Natanael Copa's avatar
Natanael Copa committed
218
ba181fe1abaac7b898ccb40b0713455aa3c9d5e25ad21d687b6cac09b0105b9e376526e7c776a44636234d8db819709d8d6a6cc76119bc3e98b637b1a3f26c08  freshclam.confd
219
3ae493dd1610a819402c015f6b8c0f080f926b72dc43d2bded60030bf6a55040e4b88e0f64d3aae299dc1133d7e1b89855e7346b4665a64e8b82592f7b75cf6a  clamd.logrotate
220
30cff378bc28c76b795e00c92ae5ee623f3abe4a19bed61dd8403c96e72658bb02b7f040d26a6258104af754464d25ea7d9646918c4b47d2ba9a8cbf4687056c  freshclam.logrotate"