summaryrefslogtreecommitdiffstats
path: root/main/clamav/APKBUILD
blob: 716d57076bf8a4aa92f7f7cd635be43d241c5bd8 (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
# Contributor: Carlo Landmeter <clandmeter at gmail>
# Maintainer: Carlo Landmeter <clandmeter at gmail>
pkgname=clamav
pkgver=0.97.8
pkgrel=0
pkgusers=clamav
pkggroups=clamav
pkgdesc="An anti-virus toolkit for UNIX"
url="http://www.clamav.net/"
arch="all"
license="GPL"
depends="logrotate"
install="$pkgname.pre-install $pkgname.pre-upgrade"
makedepends="ncurses-dev zlib-dev"
subpackages="$pkgname-doc $pkgname-dev"
source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz
	clamd.initd
	clamd.confd
	freshclam.initd
	freshclam.confd
	clamav-0.95.1-nls.patch
	clamav.logrotate
	freshclam.logrotate
	"

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

prepare() {
	cd "$_builddir"

	patch -p0 -i "$srcdir/clamav-0.95.1-nls.patch" || return 1
}

build() {
	cd "$_builddir"

	./configure --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
	
	make || return 1
}

package() {
        cd "$_builddir"

	make DESTDIR="$pkgdir" install

        # Change /etc/clamd.conf to be usable out of the box
        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

        # Do the same for /etc/freshclam.conf
        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

        install -m755 -D "$srcdir"/clamd.initd "$pkgdir"/etc/init.d/clamd || return 1
        install -m644 -D "$srcdir"/clamd.confd "$pkgdir"/etc/conf.d/clamd || return 1
        install -m755 -D "$srcdir"/freshclam.initd "$pkgdir"/etc/init.d/freshclam || return 1
        install -m644 -D "$srcdir"/freshclam.confd "$pkgdir"/etc/conf.d/freshclam || return 1
        install -m644 -D "$srcdir"/clamav.logrotate "$pkgdir"/etc/logrotate.d/clamav || return 1
        install -m644 -D "$srcdir"/freshclam.logrotate \
                "$pkgdir"/etc/logrotate.d/freshclam || return 1
	install -d -m755 -o clamav -g clamav \
		"$pkgdir"/var/run/clamav \
                "$pkgdir"/var/log/clamav \
                "$pkgdir"/var/lib/clamav || return 1
	find "$pkgdir" -iname *.la -delete
}

md5sums="ac52bcbad3ea72eac08fedb9772f648b  clamav-0.97.8.tar.gz
d64432c463850663c5041c3097f3e903  clamd.initd
567bc32b657dd7031b9b7beaa946203a  clamd.confd
f4d1f415322905128dc27135566ad136  freshclam.initd
e48466ddfb56f66c623b83e58777b778  freshclam.confd
0d08fd29656bd4b018ecf8ce9706ac55  clamav-0.95.1-nls.patch
dffa5af2e7a563fc00fcd52ec4c02347  clamav.logrotate
226824214c021b2366f0be1289561d17  freshclam.logrotate"