#!/bin/bash

# Usage:
# bash <(curl -s https://scripts.justman10000.de/installers/clamav.sh)

version=1.5.1

wget https://www.clamav.net/downloads/production/clamav-$version.linux.x86_64.deb
dpkg -i clamav-$version.linux.x86_64.deb
rm clamav-$version.linux.x86_64.deb

sed -i 's|Example|# Example|g' /etc/clamav/freshclam.conf
sed -i 's|#DatabaseMirror database.clamav.net|DatabaseMirror database.clamav.net|g' /etc/clamav/freshclam.conf
sed -i 's|#DatabaseOwner clamav|DatabaseOwner root|g' /etc/clamav/freshclam.conf

mkdir /etc/clamav || echo "Konfigurationsverzeichnis bereits erstellt!" && echo ""
clamconf -g freshclam.conf > /etc/clamav/freshclam.conf
clamconf -g clamd.conf > /etc/clamav/clamd.conf
clamconf -g clamav-milter.conf > /etc/clamav/clamav-milter.conf

freshclam --config-file=/etc/clamav/freshclam.conf --datadir=/etc/clamav/db --log=/var/log/freshclam.log --show-progress -d

# clamscan --database=/etc/clamav/db/main.cvd --recursive=yes --infected