[ClamAV] Do not try to modify cross-mounted file, copy whitelist from conf to lib directory

This commit is contained in:
andryyy 2018-10-27 13:25:05 +02:00
parent af5ce48e8d
commit e04a3aed6a

View File

@ -6,15 +6,23 @@ if [[ "${SKIP_CLAMD}" =~ ^([yY][eE][sS]|[yY])+$ ]]; then
exit 0
fi
# Create log pipes
# Prepare log pipes
mkdir -p /var/log/clamav
touch /var/log/clamav/clamd.log /var/log/clamav/freshclam.log
chown -R clamav:clamav /var/log/clamav/
chown root:tty /dev/console
chmod g+rw /dev/console
# Prepare
[[ ! -f /var/lib/clamav/whitelist.ign2 ]] && touch /var/lib/clamav/whitelist.ign2
# Prepare whitelist
if [[ -s /etc/clamav/whitelist.ign2 ]]; then
cp /etc/clamav/whitelist.ign2 /var/lib/clamav/whitelist.ign2
chown clamav:clamav /var/lib/clamav/whitelist.ign2
fi
if [[ ! -f /var/lib/clamav/whitelist.ign2 ]]; then
echo "Example-Signature.Ignore-1" > /var/lib/clamav/whitelist.ign2
fi
chown clamav:clamav /var/lib/clamav/whitelist.ign2
dos2unix /var/lib/clamav/whitelist.ign2
sed -i '/^\s*$/d' /var/lib/clamav/whitelist.ign2