clamav: Shellcheck fixes
authorRosen Penev <redacted>
Sun, 10 Nov 2019 16:00:41 +0000 (17:00 +0100)
committerJosef Schlehofer <redacted>
Sat, 23 Nov 2019 17:55:22 +0000 (18:55 +0100)
Fix SC2129

Signed-off-by: Rosen Penev <redacted>
net/clamav/files/clamav.init
net/clamav/files/freshclam.init

index 2802eb1f4db225aad8497ee5ed0a1adb958dbfa7..e06dfa60c82aad68658ce2d8905f6534e2d27131 100644 (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
index 120dc803f60d0e1f8f07e7aba597360d139caa22..38842a95e13e3592488f74fc8db30f68cc685108 100644 (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
 }
 
git clone https://git.99rst.org/PROJECT