Browse Source

clamav: Shellcheck fixes

Fix SC2129

Signed-off-by: Rosen Penev <rosenp@gmail.com>
lilik-openwrt-22.03
Rosen Penev 5 years ago
committed by Josef Schlehofer
parent
commit
2707a95d31
No known key found for this signature in database GPG Key ID: B950216FE4329F4C
2 changed files with 51 additions and 47 deletions
  1. +38
    -36
      net/clamav/files/clamav.init
  2. +13
    -11
      net/clamav/files/freshclam.init

+ 38
- 36
net/clamav/files/clamav.init View File

@ -52,47 +52,49 @@ start_clamav_instance() {
return 1
}
mkdir -p $DatabaseDirectory
mkdir -p "$DatabaseDirectory"
mkdir -p /etc/clamav/
mkdir -p /var/run/clamav/
chmod a+rw /var/run/clamav
mkdir -p $(dirname $CLAMD_CONFIGFILE)
ln -sf $clamd_config_file $CLAMD_CONFIGFILE
mkdir -p "$(dirname $CLAMD_CONFIGFILE)"
ln -sf "$clamd_config_file" "$CLAMD_CONFIGFILE"
echo "LogFile " $LogFile > $CLAMD_CONFIGFILE
echo "LogFileMaxSize " $LogFileMaxSize >> $CLAMD_CONFIGFILE
echo "LogVerbose " $LogVerbose >> $CLAMD_CONFIGFILE
echo "ExtendedDetectionInfo " $ExtendedDetectionInfo >> $CLAMD_CONFIGFILE
echo "LogTime " $LogTime >> $CLAMD_CONFIGFILE
echo "OfficialDatabaseOnly " $OfficialDatabaseOnly >> $CLAMD_CONFIGFILE
echo "StreamMinPort " $StreamMinPort >> $CLAMD_CONFIGFILE
echo "StreamMaxPort " $StreamMaxPort >> $CLAMD_CONFIGFILE
echo "MaxThreads " $MaxThreads >> $CLAMD_CONFIGFILE
echo "ReadTimeout " $ReadTimeout >> $CLAMD_CONFIGFILE
echo "CommandReadTimeout " $CommandReadTimeout >> $CLAMD_CONFIGFILE
echo "MaxDirectoryRecursion " $MaxDirectoryRecursion >> $CLAMD_CONFIGFILE
echo "FollowDirectorySymlinks " $FollowDirectorySymlinks >> $CLAMD_CONFIGFILE
echo "FollowFileSymlinks " $FollowFileSymlinks >> $CLAMD_CONFIGFILE
echo "SelfCheck " $SelfCheck >> $CLAMD_CONFIGFILE
echo "DetectPUA " $DetectPUA >> $CLAMD_CONFIGFILE
echo "ScanPE " $ScanPE >> $CLAMD_CONFIGFILE
echo "DisableCertCheck " $DisableCertCheck >> $CLAMD_CONFIGFILE
echo "ScanELF " $ScanELF >> $CLAMD_CONFIGFILE
echo "AlertBrokenExecutables " $AlertBrokenExecutables >> $CLAMD_CONFIGFILE
echo "ScanOLE2 " $ScanOLE2 >> $CLAMD_CONFIGFILE
echo "ScanPDF " $ScanPDF >> $CLAMD_CONFIGFILE
echo "ScanSWF " $ScanSWF >> $CLAMD_CONFIGFILE
echo "ScanMail " $ScanMail >> $CLAMD_CONFIGFILE
echo "ScanPartialMessages " $ScanPartialMessages >> $CLAMD_CONFIGFILE
echo "ScanArchive " $ScanArchive >> $CLAMD_CONFIGFILE
echo "TemporaryDirectory " $TemporaryDirectory >> $CLAMD_CONFIGFILE
echo "AlertEncrypted " $AlertEncrypted >> $CLAMD_CONFIGFILE
echo "MaxFileSize " $MaxFileSize >> $CLAMD_CONFIGFILE
echo "LocalSocket " $LocalSocket >> $CLAMD_CONFIGFILE
echo "User " $User >> $CLAMD_CONFIGFILE
echo "ExitOnOOM " $ExitOnOOM >> $CLAMD_CONFIGFILE
echo "DatabaseDirectory " $DatabaseDirectory >> $CLAMD_CONFIGFILE
{
echo "LogFile " "$LogFile"
echo "LogFileMaxSize " "$LogFileMaxSize"
echo "LogVerbose " "$LogVerbose"
echo "ExtendedDetectionInfo " "$ExtendedDetectionInfo"
echo "LogTime " "$LogTime"
echo "OfficialDatabaseOnly " "$OfficialDatabaseOnly"
echo "StreamMinPort " "$StreamMinPort"
echo "StreamMaxPort " "$StreamMaxPort"
echo "MaxThreads " "$MaxThreads"
echo "ReadTimeout " "$ReadTimeout"
echo "CommandReadTimeout " "$CommandReadTimeout"
echo "MaxDirectoryRecursion " "$MaxDirectoryRecursion"
echo "FollowDirectorySymlinks " "$FollowDirectorySymlinks"
echo "FollowFileSymlinks " "$FollowFileSymlinks"
echo "SelfCheck " "$SelfCheck"
echo "DetectPUA " "$DetectPUA"
echo "ScanPE " "$ScanPE"
echo "DisableCertCheck " "$DisableCertCheck"
echo "ScanELF " "$ScanELF"
echo "AlertBrokenExecutables " "$AlertBrokenExecutables"
echo "ScanOLE2 " "$ScanOLE2"
echo "ScanPDF " "$ScanPDF"
echo "ScanSWF " "$ScanSWF"
echo "ScanMail " "$ScanMail"
echo "ScanPartialMessages " "$ScanPartialMessages"
echo "ScanArchive " "$ScanArchive"
echo "TemporaryDirectory " "$TemporaryDirectory"
echo "AlertEncrypted " "$AlertEncrypted"
echo "MaxFileSize " "$MaxFileSize"
echo "LocalSocket " "$LocalSocket"
echo "User " "$User"
echo "ExitOnOOM " "$ExitOnOOM"
echo "DatabaseDirectory " "$DatabaseDirectory"
} > "$CLAMD_CONFIGFILE"
procd_open_instance
procd_set_param command $PROG -c $CLAMD_CONFIGFILE


+ 13
- 11
net/clamav/files/freshclam.init View File

@ -27,20 +27,22 @@ start_freshclam_instance() {
[ -f /tmp/freshclam.pid ] && echo "already running" && return 0
mkdir -p $DatabaseDirectory
mkdir -p "$DatabaseDirectory"
mkdir -p /etc/clamav
touch /tmp/freshclam.log
touch /tmp/freshclam.pid
mkdir -p $(dirname $FRESHCLAM_CONFIGFILE)
ln -sf $freshclam_config_file $FRESHCLAM_CONFIGFILE
mkdir -p "$(dirname $FRESHCLAM_CONFIGFILE)"
ln -sf "$freshclam_config_file" "$FRESHCLAM_CONFIGFILE"
echo "UpdateLogFile " $UpdateLogFile > $FRESHCLAM_CONFIGFILE
echo "DatabaseMirror " $DatabaseMirror >> $FRESHCLAM_CONFIGFILE
echo "NotifyClamd " $NotifyClamd >> $FRESHCLAM_CONFIGFILE
echo "DatabaseOwner " $DatabaseOwner >> $FRESHCLAM_CONFIGFILE
echo "CompressLocalDatabase " $CompressLocalDatabase >> $FRESHCLAM_CONFIGFILE
echo "DatabaseDirectory " $DatabaseDirectory >> $FRESHCLAM_CONFIGFILE
{
echo "UpdateLogFile " "$UpdateLogFile"
echo "DatabaseMirror " "$DatabaseMirror"
echo "NotifyClamd " "$NotifyClamd"
echo "DatabaseOwner " "$DatabaseOwner"
echo "CompressLocalDatabase " "$CompressLocalDatabase"
echo "DatabaseDirectory " "$DatabaseDirectory"
} > "$FRESHCLAM_CONFIGFILE"
procd_open_instance
procd_set_param command $PROG -d --config-file=$FRESHCLAM_CONFIGFILE -p /tmp/freshclam.pid --no-warnings
@ -56,8 +58,8 @@ start_service()
stop_service()
{
[ ! -f /tmp/freshclam.pid ] && echo "not running" && return 0
PID=`cat /tmp/freshclam.pid`
kill $PID
PID=$(cat /tmp/freshclam.pid)
kill "$PID"
rm -f /tmp/freshclam.pid
}


Loading…
Cancel
Save