aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlo Landmeter <clandmeter@gmail.com>2011-05-20 15:56:01 +0000
committerCarlo Landmeter <clandmeter@gmail.com>2011-05-20 15:59:33 +0000
commit14861f32173de43ae7a88d2464bf63cae9182d79 (patch)
treee3b26cf65e86c79ea66dcf6fe06146e484570180
parentb17c6c49f3f2503d4e799e22ec4e463576c11acc (diff)
downloadaports-14861f32173de43ae7a88d2464bf63cae9182d79.tar.bz2
aports-14861f32173de43ae7a88d2464bf63cae9182d79.tar.xz
main/clamav: split package and move db to /var/lib/clamav
-rw-r--r--main/clamav/APKBUILD136
-rw-r--r--main/clamav/clamav-daemon.post-install3
-rw-r--r--main/clamav/clamav-daemon.pre-install (renamed from main/clamav/clamav.pre-install)0
-rw-r--r--main/clamav/clamav-daemon.pre-upgrade11
-rw-r--r--main/clamav/clamav-db.post-install3
-rw-r--r--main/clamav/clamav-db.pre-install4
-rw-r--r--main/clamav/clamav-db.pre-upgrade (renamed from main/clamav/clamav.pre-upgrade)5
-rw-r--r--main/clamav/clamav.logrotate15
-rw-r--r--main/clamav/clamav.post-install3
-rw-r--r--main/clamav/clamd.logrotate8
-rw-r--r--main/clamav/freshclam.logrotate7
11 files changed, 136 insertions, 59 deletions
diff --git a/main/clamav/APKBUILD b/main/clamav/APKBUILD
index 36a7ee5924..9adb48a7ab 100644
--- a/main/clamav/APKBUILD
+++ b/main/clamav/APKBUILD
@@ -2,92 +2,156 @@
# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
pkgname=clamav
pkgver=0.97
-pkgrel=2
+pkgrel=3
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.post-install $pkgname.pre-upgrade"
+depends="$pkgname-scanner $pkgname-daemon"
+install=""
makedepends="ncurses-dev zlib-dev"
-subpackages="$pkgname-doc $pkgname-dev $pkgname-lib"
+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
- clamav.logrotate
+ 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
-
+ --disable-llvm \
+ --with-dbdir=/var/lib/clamav \
+ --enable-clamdtop
make || return 1
}
package() {
- cd "$_builddir"
-
+ 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
+lib() {
+ pkgdesc="ClamAV library"
+ depends=""
+ mkdir -p "$subpkgdir"/usr/lib
+ mv "$pkgdir"/usr/lib/libclamav.so.* \
+ "$subpkgdir"/usr/lib/
+}
- # Do the same for /etc/freshclam.conf
- sed -i -e "s:^\(Example\):\# \1:" \
+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:" \
- "$pkgdir"/etc/clamav/freshclam.conf
+ "$subpkgdir"/etc/clamav/freshclam.conf
+ install -m644 -D "$srcdir"/freshclam.logrotate \
+ "$subpkgdir"/etc/logrotate.d/freshclam || return 1
+}
- install -m755 -D "$srcdir"/clamd.initd "$pkgdir"/etc/init.d/clamd
- install -m644 -D "$srcdir"/clamd.confd "$pkgdir"/etc/conf.d/clamd
- install -m755 -D "$srcdir"/freshclam.initd "$pkgdir"/etc/init.d/freshclam
- install -m644 -D "$srcdir"/freshclam.confd "$pkgdir"/etc/conf.d/freshclam
- install -m644 -D "$srcdir"/clamav.logrotate "$pkgdir"/etc/logrotate.d/clamav
- mkdir -p "$pkgdir"/var/run/clamav "$pkgdir"/var/log/clamav
+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
+
}
-lib() {
- pkgdesc="ClamAV library"
- mkdir -p "$subpkgdir"/usr/lib
- mv "$pkgdir"/usr/lib/libclamav.so.* \
- "$subpkgdir"/usr/lib/
+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
-dffa5af2e7a563fc00fcd52ec4c02347 clamav.logrotate"
+ae1e48ab56a0fff1acdde023c1f6f350 clamd.logrotate
+226824214c021b2366f0be1289561d17 freshclam.logrotate"
diff --git a/main/clamav/clamav-daemon.post-install b/main/clamav/clamav-daemon.post-install
new file mode 100644
index 0000000000..e40badb09b
--- /dev/null
+++ b/main/clamav/clamav-daemon.post-install
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+chown -R clamav:clamav /var/run/clamav /var/log/clamav
diff --git a/main/clamav/clamav.pre-install b/main/clamav/clamav-daemon.pre-install
index 59ac60a44d..59ac60a44d 100644
--- a/main/clamav/clamav.pre-install
+++ b/main/clamav/clamav-daemon.pre-install
diff --git a/main/clamav/clamav-daemon.pre-upgrade b/main/clamav/clamav-daemon.pre-upgrade
new file mode 100644
index 0000000000..c8f82dacd4
--- /dev/null
+++ b/main/clamav/clamav-daemon.pre-upgrade
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# make sure we don't lose our config
+mkdir -p /etc/clamav
+if [ -f /etc/clamav.conf ]; then
+ mv /etc/clamav.conf /etc/clamav/
+ ln -s clamav/clamav.conf /etc/clamav.conf
+fi
+
+exit 0
+
diff --git a/main/clamav/clamav-db.post-install b/main/clamav/clamav-db.post-install
new file mode 100644
index 0000000000..b43342f31a
--- /dev/null
+++ b/main/clamav/clamav-db.post-install
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+chown -R clamav:clamav /var/lib/clamav /var/run/clamav /var/log/clamav
diff --git a/main/clamav/clamav-db.pre-install b/main/clamav/clamav-db.pre-install
new file mode 100644
index 0000000000..59ac60a44d
--- /dev/null
+++ b/main/clamav/clamav-db.pre-install
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+adduser -H -s /bin/false -D clamav 2>/dev/null
+exit 0
diff --git a/main/clamav/clamav.pre-upgrade b/main/clamav/clamav-db.pre-upgrade
index 9956f95d63..47230e16b2 100644
--- a/main/clamav/clamav.pre-upgrade
+++ b/main/clamav/clamav-db.pre-upgrade
@@ -2,11 +2,6 @@
# make sure we don't lose our config
mkdir -p /etc/clamav
-if [ -f /etc/clamav.conf ]; then
- mv /etc/clamav.conf /etc/clamav/
- ln -s clamav/clamav.conf /etc/clamav.conf
-fi
-
if [ -f /etc/freshclam.conf ]; then
mv /etc/freshclam.conf /etc/clamav/
ln -s clamav/freshclam.conf /etc/freshclam.conf
diff --git a/main/clamav/clamav.logrotate b/main/clamav/clamav.logrotate
deleted file mode 100644
index 7574428413..0000000000
--- a/main/clamav/clamav.logrotate
+++ /dev/null
@@ -1,15 +0,0 @@
-/var/log/clamav/clamd.log {
- missingok
- postrotate
- /etc/init.d/clamd logfix
- /bin/kill -HUP `cat /var/run/clamav/clamd.pid 2> /dev/null` 2>/dev/null || true
- endscript
-}
-
-/var/log/clamav/freshclam.log {
- missingok
- postrotate
- /etc/init.d/freshclam logfix
- /bin/kill -HUP `cat /var/run/clamav/freshclam.pid 2> /dev/null` 2>/dev/null || true
- endscript
-}
diff --git a/main/clamav/clamav.post-install b/main/clamav/clamav.post-install
deleted file mode 100644
index 4930206101..0000000000
--- a/main/clamav/clamav.post-install
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-chown -R clamav:clamav /usr/share/clamav /var/run/clamav /var/log/clamav
diff --git a/main/clamav/clamd.logrotate b/main/clamav/clamd.logrotate
new file mode 100644
index 0000000000..3d7fc79cad
--- /dev/null
+++ b/main/clamav/clamd.logrotate
@@ -0,0 +1,8 @@
+/var/log/clamav/clamd.log {
+ missingok
+ postrotate
+ /etc/init.d/clamd logfix
+ /bin/kill -HUP `cat /var/run/clamav/clamd.pid 2> /dev/null` 2>/dev/null || true
+ endscript
+}
+
diff --git a/main/clamav/freshclam.logrotate b/main/clamav/freshclam.logrotate
new file mode 100644
index 0000000000..df42d6084f
--- /dev/null
+++ b/main/clamav/freshclam.logrotate
@@ -0,0 +1,7 @@
+/var/log/clamav/freshclam.log {
+ missingok
+ postrotate
+ /etc/init.d/freshclam logfix
+ /bin/kill -HUP `cat /var/run/clamav/freshclam.pid 2> /dev/null` 2>/dev/null || true
+ endscript
+}