summaryrefslogtreecommitdiff
path: root/virtual
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2016-07-29 13:43:21 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2016-07-29 13:43:21 +0100
commit02aee10868bf44f1be66cf62750675ca79325f29 (patch)
tree9044c66459a9d9da0c24e4d2455213d0f4932147 /virtual
parentWrite update errors to file (diff)
downloadportage-02aee10868bf44f1be66cf62750675ca79325f29.tar.bz2
portage-02aee10868bf44f1be66cf62750675ca79325f29.tar.xz
portage-02aee10868bf44f1be66cf62750675ca79325f29.zip
Use clamd if it's available
Diffstat (limited to 'virtual')
-rwxr-xr-xvirtual/miller-base/files/weekly-av-scan.cron30
1 files changed, 25 insertions, 5 deletions
diff --git a/virtual/miller-base/files/weekly-av-scan.cron b/virtual/miller-base/files/weekly-av-scan.cron
index fe644d7..7823809 100755
--- a/virtual/miller-base/files/weekly-av-scan.cron
+++ b/virtual/miller-base/files/weekly-av-scan.cron
@@ -1,8 +1,28 @@
#!/bin/bash
-eval $(emerge --info -v | grep '^DISTDIR="[^"]*"$')
+EXCL=$(
+ portageq distdir
+ portageq pkgdir
+ portageq get_repo_path / $(portageq get_repos /)
+)
+ROOTS=$(mount | grep ^/dev/ | sort -u -k1,1 | cut -d ' ' -f 3 | sort)
-nice clamscan -ri --cross-fs=no \
- --exclude-dir=${DISTDIR} \
- $(emerge --info | sed -ne 's/\s\+location:\s\+\(.*\)/--exclude-dir="\1"/p') \
- $(mount | grep ^/dev/ | sort -u -k1,1 | cut -d ' ' -f 3 | sort)
+echo "Scanning:"
+echo $ROOTS
+echo
+echo "Excluding:"
+echo $EXCL
+echo
+
+if [ -S /run/clamav/clamd.sock ] ; then
+ echo "Using clamd"
+ EXCLARGS=$(ls -1d $EXCL | sed -ne 's/\(.*\)/-path "\1" -prune -o/p')
+ rm -f /tmp/scan
+ mkfifo /tmp/scan
+ find $ROOTS -xdev -type f $EXCLARGS -print > /tmp/scan &
+ clamdscan -i --fdpass -f /tmp/scan
+ rm -f /tmp/scan
+else
+ EXCLARGS=$(ls -1d $EXCL | sed -ne 's/\(.*\)/--exclude-dir="\1"/p')
+ nice clamscan -ri --cross-fs=no $ROOTS $EXCLARGS
+fi