Working setup for CentOS.

This commit is contained in:
Antoine Nguyen
2016-06-01 15:30:59 +02:00
parent 451c3b4695
commit 89cdc314ea
15 changed files with 129 additions and 25 deletions

View File

@@ -12,7 +12,6 @@ class Clamav(base.Installer):
"""ClamAV installer."""
appname = "clamav"
daemon_name = "clamav-daemon"
packages = {
"deb": ["clamav-daemon"],
"rpm": [
@@ -55,17 +54,23 @@ class Clamav(base.Installer):
user = "clamupdate"
utils.exec_cmd(
"perl -pi -e 's/^Example/#Example/' /etc/freshclam.conf")
utils.exec_cmd(
"""cat <<EOM >> /usr/lib/systemd/system/clamd@.service
# Check if not present before
path = "/usr/lib/systemd/system/clamd@.service"
code, output = utils.exec_cmd(
"grep 'WantedBy=multi-user.target' {}".format(path))
if code:
utils.exec_cmd(
"""cat <<EOM >> {}
[Install]
WantedBy=multi-user.target
EOM
""")
""".format(path))
if utils.dist_name == "ubuntu":
if utils.dist_name() == "ubuntu":
# Stop freshclam daemon to allow manual download
utils.exec_cmd("service clamav-freshclam stop")
utils.exec_cmd("freshclam", sudo_user=user)
utils.exec_cmd("service clamav-freshclam start")
else:
utils.exec_cmd("freshclam", sudo_user=user)
utils.exec_cmd("freshclam", sudo_user=user, login=False)