Merge pull request #8102 from jefferyto/clamav-init
clamav: Update init scripts
This commit is contained in:
commit
e643653a49
3 changed files with 18 additions and 18 deletions
|
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=clamav
|
PKG_NAME:=clamav
|
||||||
PKG_VERSION:=0.101.1
|
PKG_VERSION:=0.101.1
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=2
|
||||||
|
|
||||||
PKG_LICENSE:=GPL-2.0
|
PKG_LICENSE:=GPL-2.0
|
||||||
PKG_MAINTAINER:=Marko Ratkaj <marko.ratkaj@sartura.hr> \
|
PKG_MAINTAINER:=Marko Ratkaj <marko.ratkaj@sartura.hr> \
|
||||||
|
|
|
@ -9,7 +9,7 @@ PROG=/usr/sbin/clamd
|
||||||
CLAMD_CONFIGFILE="/tmp/clamav/clamd.conf"
|
CLAMD_CONFIGFILE="/tmp/clamav/clamd.conf"
|
||||||
|
|
||||||
validate_clamav_section() {
|
validate_clamav_section() {
|
||||||
uci_validate_section clamav clamav "${1}" \
|
uci_load_validate clamav clamav "$1" "$2" \
|
||||||
'clamd_config_file:string' \
|
'clamd_config_file:string' \
|
||||||
'LogFile:string' \
|
'LogFile:string' \
|
||||||
'LogFileMaxSize:string' \
|
'LogFileMaxSize:string' \
|
||||||
|
@ -46,15 +46,8 @@ validate_clamav_section() {
|
||||||
'DatabaseDirectory:string'
|
'DatabaseDirectory:string'
|
||||||
}
|
}
|
||||||
|
|
||||||
start_service() {
|
start_clamav_instance() {
|
||||||
local clamd_config_file LogFile LogTime StreamMinPort \
|
[ "$2" = 0 ] || {
|
||||||
StreamMaxPort MaxThreads ReadTimeout CommandReadTimeout MaxDirectoryRecursion \
|
|
||||||
FollowFileSymlinks FollowDirectorySymlinks SelfCheck DetectPUA ScanPE DisableCertCheck \
|
|
||||||
ScanELF DetectBrokenExecutables ScanOLE2 ScanPDF ScanSWF ScanMail ScanPartialMessages \
|
|
||||||
ScanArchive TemporaryDirectory ArchiveBlockEncrypted MaxFileSize LocalSocket User \
|
|
||||||
DatabaseDirectory
|
|
||||||
|
|
||||||
validate_clamav_section clamav || {
|
|
||||||
echo "validation failed"
|
echo "validation failed"
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
@ -107,9 +100,14 @@ start_service() {
|
||||||
procd_close_instance
|
procd_close_instance
|
||||||
}
|
}
|
||||||
|
|
||||||
|
start_service()
|
||||||
|
{
|
||||||
|
validate_clamav_section clamav start_clamav_instance
|
||||||
|
}
|
||||||
|
|
||||||
stop_service()
|
stop_service()
|
||||||
{
|
{
|
||||||
service_stop ${PROG}
|
service_stop $PROG
|
||||||
}
|
}
|
||||||
|
|
||||||
service_triggers()
|
service_triggers()
|
||||||
|
|
|
@ -9,7 +9,7 @@ PROG=/usr/sbin/freshclam
|
||||||
FRESHCLAM_CONFIGFILE="/tmp/clamav/freshclam.conf"
|
FRESHCLAM_CONFIGFILE="/tmp/clamav/freshclam.conf"
|
||||||
|
|
||||||
validate_freshclam_section() {
|
validate_freshclam_section() {
|
||||||
uci_validate_section freshclam freshclam "${1}" \
|
uci_load_validate freshclam freshclam "$1" "$2" \
|
||||||
'freshclam_config_file:string' \
|
'freshclam_config_file:string' \
|
||||||
'UpdateLogFile:string' \
|
'UpdateLogFile:string' \
|
||||||
'DatabaseMirror:string' \
|
'DatabaseMirror:string' \
|
||||||
|
@ -19,11 +19,8 @@ validate_freshclam_section() {
|
||||||
'DatabaseDirectory:string:'
|
'DatabaseDirectory:string:'
|
||||||
}
|
}
|
||||||
|
|
||||||
start_service() {
|
start_freshclam_instance() {
|
||||||
local freshclam_config_file UpdateLogFile DatabaseOwner NotifyClamd DatabaseMirror \
|
[ "$2" = 0 ] || {
|
||||||
DatabaseDirectory
|
|
||||||
|
|
||||||
validate_freshclam_section freshclam || {
|
|
||||||
echo "validation failed"
|
echo "validation failed"
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
@ -51,6 +48,11 @@ start_service() {
|
||||||
procd_close_instance
|
procd_close_instance
|
||||||
}
|
}
|
||||||
|
|
||||||
|
start_service()
|
||||||
|
{
|
||||||
|
validate_freshclam_section freshclam start_freshclam_instance
|
||||||
|
}
|
||||||
|
|
||||||
stop_service()
|
stop_service()
|
||||||
{
|
{
|
||||||
[ ! -f /tmp/freshclam.pid ] && echo "not running" && return 0
|
[ ! -f /tmp/freshclam.pid ] && echo "not running" && return 0
|
||||||
|
|
Loading…
Reference in a new issue