APKBUILD 6.5 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 7
pkgver=0.99.3
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 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

Carlo Landmeter's avatar
Carlo Landmeter committed
32
builddir="$srcdir/$pkgname-$pkgver"
Carlo Landmeter's avatar
Carlo Landmeter committed
33

TBK's avatar
TBK committed
34 35 36 37 38 39 40 41 42 43
# secfixes:
#   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

44
prepare() {
Carlo Landmeter's avatar
Carlo Landmeter committed
45 46
	update_config_sub
	default_prepare
47 48
}

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

package() {
Carlo Landmeter's avatar
Carlo Landmeter committed
72 73
	cd "$builddir"
	make DESTDIR="$pkgdir" install
74

75
	# set proper defaults
76
	sed -i -e "s:^\(Example\):\# \1:" \
77
                -e "s:.*\(PidFile\) .*:\1 /run/clamav/freshclam.pid:" \
78 79 80 81 82
                -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:" \
83
                "$pkgdir"/etc/clamav/freshclam.conf.sample
84 85 86

	# set proper defaults
        sed -i -e "s:^\(Example\):\# \1:" \
87 88
                -e "s:.*\(PidFile\) .*:\1 /run/clamav/clamd.pid:" \
                -e "s:.*\(LocalSocket\) .*:\1 /run/clamav/clamd.sock:" \
89 90 91 92
                -e "s:.*\(User\) .*:\1 clamav:" \
                -e "s:^\#\(LogFile\) .*:\1 /var/log/clamav/clamd.log:" \
                -e "s:^\#\(LogTime\).*:\1 yes:" \
               -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
93
                "$pkgdir"/etc/clamav/clamd.conf.sample
94
}
Carlo Landmeter's avatar
Carlo Landmeter committed
95

Carlo Landmeter's avatar
Carlo Landmeter committed
96 97 98 99 100
check() {
	cd "$builddir"
	make check
}

101 102 103
lib() {
	pkgdesc="ClamAV library"
	depends=""
104
	replaces="clamav"
105 106 107 108
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libclamav.so.* \
		"$subpkgdir"/usr/lib/
}
109

110 111 112
libunrar() {
	pkgdesc="ClamAV unrar libraries"
	depends=""
113
	replaces="clamav"
114 115 116 117 118
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libclamunrar* \
		"$subpkgdir"/usr/lib/
}

119 120
freshclam() {
	pkgdesc="Auto-updater for the Clam Antivirus scanner data-files"
121
	depends="logrotate"
122 123 124 125
	replaces="clamav clamav-db"
	mkdir -p "$subpkgdir"/usr/bin \
		"$subpkgdir"/etc/init.d \
		"$subpkgdir"/etc/conf.d \
Carlo Landmeter's avatar
Carlo Landmeter committed
126
		"$subpkgdir"/etc/clamav \
127

Carlo Landmeter's avatar
Carlo Landmeter committed
128
        mv "$pkgdir"/usr/bin/freshclam "$subpkgdir"/usr/bin
129
        mv "$pkgdir"/etc/clamav/freshclam.conf.sample \
Carlo Landmeter's avatar
Carlo Landmeter committed
130 131
		"$subpkgdir"/etc/clamav/freshclam.conf

132 133
	install -d -m755 -o clamav -g clamav \
		"$subpkgdir"/var/log/clamav \
Carlo Landmeter's avatar
Carlo Landmeter committed
134
		"$subpkgdir"/var/lib/clamav
135 136

	install -m755 -D "$srcdir"/freshclam.initd \
Carlo Landmeter's avatar
Carlo Landmeter committed
137 138 139
		"$subpkgdir"/etc/init.d/freshclam
	install -m644 -D "$srcdir"/freshclam.confd \
		"$subpkgdir"/etc/conf.d/freshclam
140
	install -m644 -D "$srcdir"/freshclam.logrotate \
Carlo Landmeter's avatar
Carlo Landmeter committed
141
		"$subpkgdir"/etc/logrotate.d/freshclam
142 143 144
}

db() {
145
	pkgdesc="ClamAV dummy package for compatibility"
146
	replaces="clamav"
147
	depends="freshclam"
148 149
	mkdir -p "$subpkgdir"/var/lib/ \
		"$subpkgdir"/usr/bin \
Carlo Landmeter's avatar
Carlo Landmeter committed
150
		"$subpkgdir"/etc/clamav
151 152
	install -d -m755 -o clamav -g clamav \
		"$subpkgdir"/var/log/clamav \
Carlo Landmeter's avatar
Carlo Landmeter committed
153
		"$subpkgdir"/var/lib/clamav
154
}
155

156 157
scanner() {
	pkgdesc="ClamAV command-line scanner and utils"
158
	replaces="clamav"
159
	depends="freshclam"
160 161
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/clamscan \
Carlo Landmeter's avatar
Carlo Landmeter committed
162
		"$subpkgdir"/usr/bin/
163
	mv "$pkgdir"/usr/bin/sigtool \
Carlo Landmeter's avatar
Carlo Landmeter committed
164
		"$subpkgdir"/usr/bin/
165
	mv "$pkgdir"/usr/bin/clambc \
Carlo Landmeter's avatar
Carlo Landmeter committed
166
		"$subpkgdir"/usr/bin/
Carlo Landmeter's avatar
Carlo Landmeter committed
167 168
}

169 170
daemon() {
	pkgdesc="ClamAV daemon scanner"
171
	replaces="clamav"
172
	depends="freshclam logrotate"
173 174
        mkdir -p "$subpkgdir"/usr/bin \
		"$subpkgdir"/usr/sbin \
Carlo Landmeter's avatar
Carlo Landmeter committed
175
		"$subpkgdir"/etc/clamav
176 177 178
	install -d -m 755 -o clamav -g clamav \
		"$subpkgdir"/var/log/clamav \
		"$subpkgdir"/var/lib/clamav
179
	mv "$pkgdir"/usr/bin/clamconf \
Carlo Landmeter's avatar
Carlo Landmeter committed
180
		"$subpkgdir"/usr/bin/
181
	mv "$pkgdir"/usr/sbin/clamd \
Carlo Landmeter's avatar
Carlo Landmeter committed
182
		"$subpkgdir"/usr/sbin/
183
	mv "$pkgdir"/usr/bin/clamdtop \
Carlo Landmeter's avatar
Carlo Landmeter committed
184
		"$subpkgdir"/usr/bin/
185
	mv "$pkgdir"/usr/bin/clamdscan \
Carlo Landmeter's avatar
Carlo Landmeter committed
186
		"$subpkgdir"/usr/bin/
187
	mv "$pkgdir"/etc/clamav/clamd.conf.sample \
Carlo Landmeter's avatar
Carlo Landmeter committed
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
		"$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
205
}
206

207
sha512sums="0d3c75d571ed4aa4937ef2b743a39a9a144f5adfd6f56f71046e5a8387b8ed7c3c4d9a4196aa85750f9ec4dc545720fdd659289d0cce086ab13a7cc505a0ab3e  clamav-0.99.3.tar.gz
208
ed81be79bf9a25eec071312252121cc76c96838407377b75077bf94922055f1de99f327982ac4dccd5be85003baa95385e5d002fabab32bb851bb30178475edd  clamd.initd
Natanael Copa's avatar
Natanael Copa committed
209
59c561b3dcb0b616b647cd8e4ebc46a2cc5e7144c8c7ea0054cc1c3021d1da8f67e4dad5c083c3fe712ed887aaabfca91b538f4759537e7c4c9ab71ba4fd5794  clamd.confd
210
00daed8afb67a6e4a29893340246c8840cce970dd9103d26557ecdd26ef60b12551d2291c214fc657faaaa339484052079347411b0cad65e3a33ece56d57cf16  freshclam.initd
Natanael Copa's avatar
Natanael Copa committed
211
ba181fe1abaac7b898ccb40b0713455aa3c9d5e25ad21d687b6cac09b0105b9e376526e7c776a44636234d8db819709d8d6a6cc76119bc3e98b637b1a3f26c08  freshclam.confd
212
3ae493dd1610a819402c015f6b8c0f080f926b72dc43d2bded60030bf6a55040e4b88e0f64d3aae299dc1133d7e1b89855e7346b4665a64e8b82592f7b75cf6a  clamd.logrotate
213
30cff378bc28c76b795e00c92ae5ee623f3abe4a19bed61dd8403c96e72658bb02b7f040d26a6258104af754464d25ea7d9646918c4b47d2ba9a8cbf4687056c  freshclam.logrotate"