aboutsummaryrefslogtreecommitdiffstats
path: root/main/clamav/APKBUILD
blob: 22fcda7f9c8084b7c51e228947322eeddf8040c7 (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
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
pkgname=clamav
pkgver=0.97
pkgrel=4
pkgusers=clamav
pkggroups=clamav
pkgdesc="An anti-virus toolkit for UNIX"
url="http://www.clamav.net/"
arch="all"
license="GPL"
depends="$pkgname-scanner $pkgname-daemon"
install=""
makedepends="ncurses-dev zlib-dev"
subpackages="$pkgname-doc $pkgname-dev $pkgname-lib $pkgname-libunrar
	$pkgname-daemon $pkgname-scanner $pkgname-db"
source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz
	clamd.initd
	clamd.confd
	freshclam.initd
	freshclam.confd
	clamav-0.95.1-nls.patch
	clamd.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-dbdir=/var/lib/clamav \
		--enable-clamdtop 
	make || return 1
}

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

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

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

db() {
	pkgdesc="ClamAV virus database and update program"
	depends="logrotate"
	install="$subpkgname.pre-install $subpkgname.post-install $subpkgname.pre-upgrade"
	mkdir -p "$subpkgdir"/var/lib/ \
		"$subpkgdir"/usr/bin \
		"$subpkgdir"/etc/clamav \
		"$subpkgdir"/var/run/clamav \
		"$subpkgdir"/var/log/clamav
	mv "$pkgdir"/var/lib/clamav \
		"$subpkgdir"/var/lib/ || return 1
        mv "$pkgdir"/usr/bin/freshclam \
		"$subpkgdir"/usr/bin || 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
        mv "$pkgdir"/etc/clamav/freshclam.conf \
		"$subpkgdir"/etc/clamav/ || 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:" \
                "$subpkgdir"/etc/clamav/freshclam.conf
	install -m644 -D "$srcdir"/freshclam.logrotate \
		"$subpkgdir"/etc/logrotate.d/freshclam || return 1
}

scanner() {
	pkgdesc="ClamAV command-line scanner and utils"
	depends="$pkgname-db"
	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"
	depends="$pkgname-db logrotate"
	install="$subpkgname.pre-install $subpkgname.post-install $subpkgname.pre-upgrade"
        mkdir -p "$subpkgdir"/usr/bin \
		"$subpkgdir"/usr/sbin \
		"$subpkgdir"/etc/clamav \
                "$subpkgdir"/var/run/clamav \
		"$subpkgdir"/var/log/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
        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
	mv "$pkgdir"/etc/clamav/clamd.conf \
		"$subpkgdir"/etc/clamav/ || return 1
	# 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:" \
                "$subpkgdir"/etc/clamav/clamd.conf
        install -m644 -D "$srcdir"/clamd.logrotate \
		"$subpkgdir"/etc/logrotate.d/clamd || return 1
}

md5sums="605ed132b2f8e89df11064adea2b183b  clamav-0.97.tar.gz
d64432c463850663c5041c3097f3e903  clamd.initd
567bc32b657dd7031b9b7beaa946203a  clamd.confd
f4d1f415322905128dc27135566ad136  freshclam.initd
e48466ddfb56f66c623b83e58777b778  freshclam.confd
0d08fd29656bd4b018ecf8ce9706ac55  clamav-0.95.1-nls.patch
ae1e48ab56a0fff1acdde023c1f6f350  clamd.logrotate
226824214c021b2366f0be1289561d17  freshclam.logrotate"