Mail archive
alpine-aports

[alpine-aports] [PATCH] main/clamav: upgrade to 0.99. Minor fixes in APKBUILD, init and logrotate scripts

From: Valery Kartel <valery.kartel_at_gmail.com>
Date: Mon, 7 Dec 2015 14:36:46 +0200

---
 main/clamav/APKBUILD            | 106 ++++++++++++++++++++--------------------
 main/clamav/clamd.initd         |   3 +-
 main/clamav/clamd.logrotate     |  11 ++---
 main/clamav/freshclam.initd     |  13 ++++-
 main/clamav/freshclam.logrotate |  10 ++--
 5 files changed, 75 insertions(+), 68 deletions(-)
diff --git a/main/clamav/APKBUILD b/main/clamav/APKBUILD
index 1a9511c..5975a65 100644
--- a/main/clamav/APKBUILD
+++ b/main/clamav/APKBUILD
_at_@ -1,9 +1,10 @@
+# Contributor: Valery Kartel <valery.kartel_at_gmail.com>
 # Contributor: Ɓukasz Jendrysik <scadu_at_yandex.com>
 # Contributor: Carlo Landmeter <clandmeter_at_gmail.com>
 # Maintainer: Carlo Landmeter <clandmeter_at_gmail.com>
 pkgname=clamav
-pkgver=0.98.7
-pkgrel=2
+pkgver=0.99
+pkgrel=0
 pkgusers="clamav"
 pkggroups="clamav"
 pkgdesc="An anti-virus toolkit for UNIX"
_at_@ -13,8 +14,8 @@ license="GPL2"
 depends="$pkgname-scanner $pkgname-daemon"
 depends_dev="openssl-dev"
 install="freshclam.pre-install
-	clamav-daemon.pre-install clamav-daemon.pre-upgrade"
-makedepends="ncurses-dev zlib-dev bzip2-dev linux-headers $depends_dev"
+	$pkgname-daemon.pre-install $pkgname-daemon.pre-upgrade"
+makedepends="ncurses-dev zlib-dev bzip2-dev linux-headers $depends_dev fts-dev"
 subpackages="$pkgname-doc $pkgname-dev $pkgname-lib $pkgname-libunrar
 	$pkgname-daemon $pkgname-scanner $pkgname-db freshclam"
 source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz
_at_@ -42,19 +43,19 @@ prepare() {
 
 build() {
 	cd "$_builddir"
-	./configure \
+	LIBS=-lfts ./configure \
 		--build=$CBUILD \
 		--host=$CHOST \
 		--prefix=/usr \
 		--libdir=/usr/lib \
-		--sysconfdir=/etc/clamav \
+		--sysconfdir=/etc/$pkgname \
 		--mandir=/usr/share/man \
 		--infodir=/usr/share/info \
 		--without-iconv \
 		--disable-llvm \
-		--with-user=clamav \
-		--with-group=clamav \
-		--with-dbdir=/var/lib/clamav \
+		--with-user=$pkgusers \
+		--with-group=$pkggroups \
+		--with-dbdir=/var/lib/$pkgname \
 		--enable-clamdtop \
 		--enable-bigstack \
 		|| return 1
_at_@ -67,29 +68,29 @@ package() {
 
 	# 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:.*\(PidFile\) .*:\1 /run/$pkgname/freshclam.pid:" \
+                -e "s:.*\(DatabaseOwner\) .*:\1 $pkgusers:" \
+                -e "s:^\#\(UpdateLogFile\) .*:\1 /var/log/$pkgname/freshclam.log:" \
+                -e "s:^\#\(NotifyClamd\).*:\1 /etc/$pkgname/clamd.conf:" \
                 -e "s:^\#\(ScriptedUpdates\).*:\1 yes:" \
                 -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
-                "$pkgdir"/etc/clamav/freshclam.conf.sample
+                "$pkgdir"/etc/$pkgname/freshclam.conf.sample
 
 	# 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:.*\(PidFile\) .*:\1 /run/$pkgname/clamd.pid:" \
+                -e "s:.*\(LocalSocket\) .*:\1 /run/$pkgname/clamd.sock:" \
+                -e "s:.*\(User\) .*:\1 $pkgusers:" \
+                -e "s:^\#\(LogFile\) .*:\1 /var/log/$pkgname/clamd.log:" \
                 -e "s:^\#\(LogTime\).*:\1 yes:" \
                -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
-                "$pkgdir"/etc/clamav/clamd.conf.sample
+                "$pkgdir"/etc/$pkgname/clamd.conf.sample
 }
 
 lib() {
 	pkgdesc="ClamAV library"
 	depends=""
-	replaces="clamav"
+	replaces="$pkgname"
 	mkdir -p "$subpkgdir"/usr/lib
 	mv "$pkgdir"/usr/lib/libclamav.so.* \
 		"$subpkgdir"/usr/lib/
_at_@ -98,7 +99,7 @@ lib() {
 libunrar() {
 	pkgdesc="ClamAV unrar libraries"
 	depends=""
-	replaces="clamav"
+	replaces="$pkgname"
 	mkdir -p "$subpkgdir"/usr/lib
 	mv "$pkgdir"/usr/lib/libclamunrar* \
 		"$subpkgdir"/usr/lib/
_at_@ -107,19 +108,18 @@ libunrar() {
 freshclam() {
 	pkgdesc="Auto-updater for the Clam Antivirus scanner data-files"
 	depends="logrotate"
-	replaces="clamav clamav-db"
+	replaces="$pkgname $pkgname-db"
 	mkdir -p "$subpkgdir"/usr/bin \
 		"$subpkgdir"/etc/init.d \
 		"$subpkgdir"/etc/conf.d \
-		"$subpkgdir"/etc/clamav
+		"$subpkgdir"/etc/$pkgname
 
         mv "$pkgdir"/usr/bin/freshclam "$subpkgdir"/usr/bin || return 1
-        mv "$pkgdir"/etc/clamav/freshclam.conf.sample \
-		"$subpkgdir"/etc/clamav/ || return 1
-	install -d -m755 -o clamav -g clamav \
-                "$subpkgdir"/var/run/clamav \
-		"$subpkgdir"/var/log/clamav \
-		"$subpkgdir"/var/lib/clamav || return 1
+        mv "$pkgdir"/etc/$pkgname/freshclam.conf.sample \
+		"$subpkgdir"/etc/$pkgname/ || return 1
+	install -d -m755 -o $pkgusers -g $pkggroups \
+		"$subpkgdir"/var/log/$pkgname \
+		"$subpkgdir"/var/lib/$pkgname || return 1
 
 	install -m755 -D "$srcdir"/freshclam.initd \
 		"$subpkgdir"/etc/init.d/freshclam || return 1
_at_@ -131,21 +131,20 @@ freshclam() {
 
 db() {
 	pkgdesc="ClamAV dummy package for compatibility"
-	replaces="clamav"
+	replaces="$pkgname"
 	depends="freshclam"
 	mkdir -p "$subpkgdir"/var/lib/ \
 		"$subpkgdir"/usr/bin \
-		"$subpkgdir"/etc/clamav \
+		"$subpkgdir"/etc/$pkgname \
 		|| return 1
-	install -d -m755 -o clamav -g clamav \
-                "$subpkgdir"/var/run/clamav \
-		"$subpkgdir"/var/log/clamav \
-		"$subpkgdir"/var/lib/clamav || return 1
+	install -d -m755 -o $pkgusers -g $pkggroups \
+		"$subpkgdir"/var/log/$pkgname \
+		"$subpkgdir"/var/lib/$pkgname || return 1
 }
 
 scanner() {
 	pkgdesc="ClamAV command-line scanner and utils"
-	replaces="clamav"
+	replaces="$pkgname"
 	depends="freshclam"
 	mkdir -p "$subpkgdir"/usr/bin
 	mv "$pkgdir"/usr/bin/clamscan \
_at_@ -158,14 +157,13 @@ scanner() {
 
 daemon() {
 	pkgdesc="ClamAV daemon scanner"
-	replaces="clamav"
+	replaces="$pkgname"
 	depends="freshclam logrotate"
         mkdir -p "$subpkgdir"/usr/bin \
 		"$subpkgdir"/usr/sbin \
-		"$subpkgdir"/etc/clamav \
+		"$subpkgdir"/etc/$pkgname \
 		|| return 1
-	install -d -m 755 -o clamav -g clamav \
-                "$subpkgdir"/var/run/clamav \
+	install -d -m 755 -o $pkgusers -g $pkggroups \
 		"$subpkgdir"/var/log/clamav \
 		"$subpkgdir"/var/lib/clamav
 	mv "$pkgdir"/usr/bin/clamconf \
_at_@ -176,8 +174,8 @@ daemon() {
 		"$subpkgdir"/usr/bin/ || return 1
 	mv "$pkgdir"/usr/bin/clamdscan \
 		"$subpkgdir"/usr/bin/ || return 1
-	mv "$pkgdir"/etc/clamav/clamd.conf.sample \
-		"$subpkgdir"/etc/clamav/ || return 1
+	mv "$pkgdir"/etc/$pkgname/clamd.conf.sample \
+		"$subpkgdir"/etc/$pkgname/ || return 1
         install -m755 -D "$srcdir"/clamd.initd \
 		"$subpkgdir"/etc/init.d/clamd || return 1
         install -m644 -D "$srcdir"/clamd.confd \
_at_@ -186,24 +184,24 @@ daemon() {
 		"$pkgdir"/etc/logrotate.d/clamd || return 1
 }
 
-md5sums="157c601161da1c2d5a0e48ea1b49e067  clamav-0.98.7.tar.gz
-64ca44466837bcd69f28e01f6c96e2a9  clamd.initd
+md5sums="ae79c3982761ba1815dbce17f846bab6  clamav-0.99.tar.gz
+9886e59a3be4d9fc90fd2b255cc65e19  clamd.initd
 e8a03fad6ce603631e8fe71a24d387c6  clamd.confd
-d29c888953097041f27b2dbc21b6e94c  freshclam.initd
+05dc346626bec03adb970c27e89fdc65  freshclam.initd
 e48466ddfb56f66c623b83e58777b778  freshclam.confd
 ae1e48ab56a0fff1acdde023c1f6f350  clamd.logrotate
-226824214c021b2366f0be1289561d17  freshclam.logrotate"
-sha256sums="282417b707740de13cd8f18d4cbca9ddd181cf96b444db2cad98913a5153e272  clamav-0.98.7.tar.gz
-500fc4e6ec43f7a87cf159b0c56ca594f0a3f855ab6c80f7aa91315dcc4da941  clamd.initd
+56e88ff24d3490af599e34e6f3346d5b  freshclam.logrotate"
+sha256sums="d2792c8cfadd685fffc40b2199679628815df031fd3149ccf961649fc8787ea9  clamav-0.99.tar.gz
+0979ef626fe64ebeb0edf17465f9ce918f64f3d4e622c77b9c58f2f5ac928727  clamd.initd
 4d978313004f66d871564b873df27c5459d3cc504788b179e41edba0f04b74dc  clamd.confd
-cf945febd186528798df2e5567e108d1bcf3618c74615d8c5edee3cfad756c9c  freshclam.initd
+18924ef39bb2f3ffcfc2901a8da27d05099729a9af5ebf852e2add4980a8213c  freshclam.initd
 75551ce7e04bbef4a889bc94a357b160d9da88f06eba32df594ba3cbb2c81ed1  freshclam.confd
 ec5e60f7efca02ed151f625e9a44404346991ed6608c6e2088db2436bbd03d49  clamd.logrotate
-84006ac3d2e8dc2e13a01f5e313c20e4978cdc93d831c181e0075badcbf4ada0  freshclam.logrotate"
-sha512sums="acf01961472c13ccb219420cc3fa3c3e6f8a733edef371dbc04ce5867900aa1535e956ec8ad50d31c8f872a0a1d79fcccac944cd86e29ecdfa4af18f7fd5afb9  clamav-0.98.7.tar.gz
-9abb547591170ab07da6238a47db00bfa8eb0f962e430e9e701ff12542b81d02b86092edc0fe49aa9cfbb263cdd62db8f55d255cf1625f8532da2deee79ccc42  clamd.initd
+5127ebd370d8c62f3558c9605b4f33f7fb54bac3acf7831dc5f8c4dda1509dfa  freshclam.logrotate"
+sha512sums="328e66fa412ba61f5e44c839b254c7a84d2ce7821fda6cf29e4ee9532c06e45bdec62f202ca561223e984fff170bfd8280e5cc8e306c09a3017b17e7db3bbf56  clamav-0.99.tar.gz
+51ab46a676fbec821a8ad8b441002f726833d803920e3d98361c7fe44484d542ac3708e6f554f3d565c4f69d7616a83a8488ed3e3cf545837cca25b8e9b4b35a  clamd.initd
 59c561b3dcb0b616b647cd8e4ebc46a2cc5e7144c8c7ea0054cc1c3021d1da8f67e4dad5c083c3fe712ed887aaabfca91b538f4759537e7c4c9ab71ba4fd5794  clamd.confd
-7371e12ce6efa33684ac90a03c244b2cf626322ac8fc1e9fa8ca67a9353badea3f3eb0b3d966e286519956f94d1b5752b3d03aabb901105270010eadb0aedf72  freshclam.initd
+9d74853775908a9f57a24b8004d88d1cd630fe5e252509379a789e84dc52bf2f573f5c4e455ad8850face852de9be007956ea746509fba03f02c0836b7b94ab9  freshclam.initd
 ba181fe1abaac7b898ccb40b0713455aa3c9d5e25ad21d687b6cac09b0105b9e376526e7c776a44636234d8db819709d8d6a6cc76119bc3e98b637b1a3f26c08  freshclam.confd
 57e5b0c0dc6dc078e0102829e5d36882cff9ae5dd0637c31c7a23ef274dd0a4d967bc036f74c42b4690af511bc0a43fdb6d19b0c307506432577d82de7beff78  clamd.logrotate
-f1cd8df6d47824009a6df130bd60bf5e9f9deaef87fbeaceec8fe71e6c8b2772b5dba017390a2190deee851723256f06e9aef2182b0a2881119f22ba68740554  freshclam.logrotate"
+30cff378bc28c76b795e00c92ae5ee623f3abe4a19bed61dd8403c96e72658bb02b7f040d26a6258104af754464d25ea7d9646918c4b47d2ba9a8cbf4687056c  freshclam.logrotate"
diff --git a/main/clamav/clamd.initd b/main/clamav/clamd.initd
index 37e29ec..ebb9b13 100755
--- a/main/clamav/clamd.initd
+++ b/main/clamav/clamd.initd
_at_@ -5,6 +5,7 @@ extra_commands="logfix"
 
 NAME=clamd
 CONF=/etc/clamav/clamd.conf
+required_files=$CONF
 
 depend() {
 	need net
_at_@ -85,7 +86,7 @@ socketfix() {
 	local socketdir=${socket%/*}
         local clamav_user=`awk '$1 == "User" { print $2 }' $CONF`
 	checkpath --directory --owner ${clamav_user:-clamav} \
-		${socketdir:-/var/run/clamav}
+		${socketdir:-/run/clamav}
 }                                                     
 
 
diff --git a/main/clamav/clamd.logrotate b/main/clamav/clamd.logrotate
index 3d7fc79..dc0f5ca 100644
--- a/main/clamav/clamd.logrotate
+++ b/main/clamav/clamd.logrotate
_at_@ -1,8 +1,7 @@
 /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
+	missingok
+	postrotate
+		/etc/init.d/clamd --quiet logfix
+		/etc/init.d/clamd --quiet --ifstarted reload
+	endscript
 }
-
diff --git a/main/clamav/freshclam.initd b/main/clamav/freshclam.initd
index 4b71fbf..9b7175c 100644
--- a/main/clamav/freshclam.initd
+++ b/main/clamav/freshclam.initd
_at_@ -4,14 +4,24 @@ extra_started_commands="reload"
 extra_commands="logfix"
 
 command=/usr/bin/freshclam
-pidfile=/var/run/clamav/freshclam.pid
+pidfile=/run/clamav/freshclam.pid
 CONF=/etc/clamav/freshclam.conf
+required_files=$CONF
 
 depend() {
 	need net
 	after firewall
 }
 
+start_pre() {
+	local pid=`awk '$1 == "PidFile" { print $2 }' $CONF`
+	local owner=`awk '$1 == "DatabaseOwner" { print $2 }' $CONF`
+	[ "x$pid" != "x" ] && pidfile=$pid
+	local piddir=${pid%/*}
+	checkpath --directory --owner ${owner:-clamav} \
+		--mode 750 ${pidfile%/*}
+}
+
 start() {
 	ebegin "Starting freshclam"
 	start-stop-daemon --start --quiet \
_at_@ -50,4 +60,3 @@ logfix() {
 		chmod 640 ${logfile}
 	fi
 }
-
diff --git a/main/clamav/freshclam.logrotate b/main/clamav/freshclam.logrotate
index df42d60..18117ee 100644
--- a/main/clamav/freshclam.logrotate
+++ b/main/clamav/freshclam.logrotate
_at_@ -1,7 +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
+	missingok
+	postrotate
+		/etc/init.d/freshclam --quiet logfix
+		/etc/init.d/freshclam --quiet --ifstarted reload
+	endscript
 }
-- 
2.6.3
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Mon Dec 07 2015 - 14:36:46 GMT