#!/bin/bash

# Disable clamd apparmor as it needs some tweaking to make it work with
# our configuration
APP_PROFILE="/etc/apparmor.d/usr.sbin.clamd"
if [ -f $APP_PROFILE ]; then
    sed -i 's:^/usr/sbin/clamd:/usr/sbin/clamd.off:' $APP_PROFILE || true
    service apparmor restart || true
fi

# create directory for freshclam data
FRESHCLAM_DIR=$(perl -MEBox::AntiVirus -e'print EBox::AntiVirus::freshclamEBoxDir(); 1;');
mkdir -p $FRESHCLAM_DIR
chown clamav.clamav $FRESHCLAM_DIR
