From 57a40e0a8d0dcd8fbacf12e00aeda15e360f2294 Mon Sep 17 00:00:00 2001 From: 4fury-c3440d8 Date: Thu, 29 Dec 2022 01:44:39 +0300 Subject: [PATCH] clamav-1.0.0. --- util/antivirus/clamav/actions.py | 8 ++--- util/antivirus/clamav/comar/clamd.py | 24 +++++++++++++ util/antivirus/clamav/comar/freshclam.py | 23 +++++++++++++ util/antivirus/clamav/comar/package.py | 2 +- util/antivirus/clamav/comar/service.py | 32 ----------------- .../antivirus/clamav/files/daemon_confs.patch | 20 +++++++++-- util/antivirus/clamav/pspec.xml | 34 ++++++++++++++++--- 7 files changed, 99 insertions(+), 44 deletions(-) create mode 100644 util/antivirus/clamav/comar/clamd.py create mode 100644 util/antivirus/clamav/comar/freshclam.py delete mode 100644 util/antivirus/clamav/comar/service.py diff --git a/util/antivirus/clamav/actions.py b/util/antivirus/clamav/actions.py index d703de2c44..4bf52bbbe2 100644 --- a/util/antivirus/clamav/actions.py +++ b/util/antivirus/clamav/actions.py @@ -4,7 +4,7 @@ # Licensed under the GNU General Public License, version 3. # See the file https://www.gnu.org/licenses/gpl-3.0.txt -from pisi.actionsapi import shelltools, cmaketools, pisitools, get +from pisi.actionsapi import shelltools, mesontools, cmaketools, pisitools, get j = ''.join([ ' -DENABLE_EXAMPLES=ON', @@ -20,14 +20,14 @@ def setup(): cmaketools.configure(j) def build(): - shelltools.system("ninja -C _build") + mesontools.build("-C _build") def check(): #pass - shelltools.system("ninja -C _build test") + mesontools.build("-C _build test") def install(): - shelltools.system("DESTDIR=%s ninja -C _build install" % get.installDIR()) + mesontools.install("-C _build install") #pisitools.dodir("/run/clamav") pisitools.dodir("/var/lib/clamav") diff --git a/util/antivirus/clamav/comar/clamd.py b/util/antivirus/clamav/comar/clamd.py new file mode 100644 index 0000000000..0eeda147da --- /dev/null +++ b/util/antivirus/clamav/comar/clamd.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +#!/usr/bin/env python + +import os +from comar.service import * + +serviceType = "server" +serviceDesc = _({"en": "Clam Anti-Virus Daemon", + "tr": "Clam Antivirüs Servisi"}) + +@synchronized +def start(): + startService(command="/usr/sbin/clamd", + pidfile="/run/clamd.pid", + donotify=False) + time.sleep(4) + +@synchronized +def stop(): + stopService(command="/usr/sbin/clamd", + donotify=True) + +def status(): + return isServiceRunning("/run/clamd.pid") diff --git a/util/antivirus/clamav/comar/freshclam.py b/util/antivirus/clamav/comar/freshclam.py new file mode 100644 index 0000000000..1ee37fd95a --- /dev/null +++ b/util/antivirus/clamav/comar/freshclam.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +#!/usr/bin/env python + +import os +from comar.service import * + +serviceType = "server" +serviceDesc = _({"en": "ClamAV database updater service"}) + +@synchronized +def start(): + startService(command="/usr/bin/freshclam", + args="-d -p /run/freshclam.pid", + pidfile="/run/freshclam.pid", + donotify=True) + +@synchronized +def stop(): + stopService(command="/usr/bin/freshclam", + donotify=True) + +def status(): + return isServiceRunning("/run/freshclam.pid") diff --git a/util/antivirus/clamav/comar/package.py b/util/antivirus/clamav/comar/package.py index 266f6199ac..58c83ea5d0 100644 --- a/util/antivirus/clamav/comar/package.py +++ b/util/antivirus/clamav/comar/package.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python import os diff --git a/util/antivirus/clamav/comar/service.py b/util/antivirus/clamav/comar/service.py deleted file mode 100644 index 41df8371d1..0000000000 --- a/util/antivirus/clamav/comar/service.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- - -import os -from comar.service import * - -serviceType = "server" -serviceDesc = _({"en": "Clam Anti-Virus Daemon", - "tr": "Clam Antivirüs Servisi"}) - -@synchronized -def start(): - startService(command="/usr/sbin/clamd", - #chuid="clamav", - pidfile="/run/clamd.pid", - donotify=False) - time.sleep(3) - startService(command="/usr/bin/freshclam", - args="-d -p /run/freshclam.pid", - #chuid="clamav", - pidfile="/run/freshclam.pid", - donotify=True) - -@synchronized -def stop(): - stopService(command="/usr/sbin/clamd", - donotify=True) - time.sleep(4) - stopService(command="/usr/bin/freshclam", - donotify=True) - -def status(): - return isServiceRunning("/run/clamd.pid") and isServiceRunning("/run/freshclam.pid") diff --git a/util/antivirus/clamav/files/daemon_confs.patch b/util/antivirus/clamav/files/daemon_confs.patch index 5f68b3c227..25e18fc245 100644 --- a/util/antivirus/clamav/files/daemon_confs.patch +++ b/util/antivirus/clamav/files/daemon_confs.patch @@ -12,7 +12,7 @@ index 7ca0e6e..98af596 100644 ## diff --git a/etc/clamd.conf.sample b/etc/clamd.conf.sample -index 2f18866..8a2580b 100644 +index 37fb03b..997f573 100644 --- a/etc/clamd.conf.sample +++ b/etc/clamd.conf.sample @@ -5,13 +5,13 @@ @@ -76,11 +76,20 @@ index 2f18866..8a2580b 100644 # TCP address. # By default we bind to INADDR_ANY, probably not wise. +@@ -218,7 +218,7 @@ Example + + # Run as another user (clamd must be started by root for this option to work) + # Default: don't drop privileges +-#User clamav ++User clamav + + # Stop daemon when libclamav reports out of memory condition. + #ExitOnOOM yes diff --git a/etc/freshclam.conf.sample b/etc/freshclam.conf.sample -index 26c4e7a..5f791e8 100644 +index 26c4e7a..1447490 100644 --- a/etc/freshclam.conf.sample +++ b/etc/freshclam.conf.sample -@@ -5,12 +5,12 @@ +@@ -5,16 +5,16 @@ # Comment or remove the line below. @@ -95,6 +104,11 @@ index 26c4e7a..5f791e8 100644 # Path to the log file (make sure it has proper permissions) # Default: disabled +-#UpdateLogFile /var/log/freshclam.log ++UpdateLogFile /var/log/freshclam.log + + # Maximum size of the log file. + # Value of 0 disables the limit. @@ -51,7 +51,7 @@ Example # It is recommended that the directory where this file is stored is # also owned by root to keep other users from tampering with it. diff --git a/util/antivirus/clamav/pspec.xml b/util/antivirus/clamav/pspec.xml index 80e92bd3f2..36b3b71245 100644 --- a/util/antivirus/clamav/pspec.xml +++ b/util/antivirus/clamav/pspec.xml @@ -12,8 +12,8 @@ app:console Clam Antivirus software. Clam AntiVirus is a GPL anti-virus toolkit for UNIX. - - https://www.clamav.net/downloads/production/clamav-0.105.1.tar.gz + + https://www.clamav.net/downloads/production/clamav-1.0.0.tar.gz rust @@ -50,9 +50,9 @@ + /etc/clamav /usr/bin /usr/sbin - /etc/clamav /usr/lib /run/clamav /var/lib/clamav @@ -65,7 +65,26 @@ System.Package - System.Service + System.Service + + + + + freshclam + + clamav + + + /etc/clamav/freshclam.conf + /usr/bin/freshclam + /usr/lib/libfreshclam.so + /usr/lib/libfreshclam.so.2 + /usr/lib/libfreshclam.so.2.0.2 + /usr/share/man/man1/freshclam.1 + /usr/share/man/man5/freshclam.conf.5 + + + System.Service @@ -81,6 +100,13 @@ + + 2022-12-25 + 1.0.0 + Version bump. + fury + uglyside@yandex.ru + 2022-11-15 0.105.1