Skip to content

Commit bae519c

Browse files
committed
Install ClamAV in a temporary directory
1 parent b292daf commit bae519c

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

action.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,18 @@ runs:
7878
if: runner.os == 'Windows'
7979
env:
8080
CLAMAV_WIN_VERSION: clamav-1.0.4.win.x64
81+
DB_MAIN: ${{ inputs.db_main }}
82+
DB_DAILY: ${{ inputs.db_daily }}
8183
shell: pwsh
8284
run: |
83-
curl -L -o clamav.zip https://www.clamav.net/downloads/production/${{ env.CLAMAV_WIN_VERSION }}.zip
84-
tar -xf clamav.zip
85-
cp clamd.conf ${{ env.CLAMAV_WIN_VERSION }}
86-
cp freshclam.conf ${{ env.CLAMAV_WIN_VERSION }}
87-
${{ env.CLAMAV_WIN_VERSION }}\freshclam.exe -F --update-db=bytecode `
88-
$(if ("${{ inputs.db_main }}" -eq "true") { "--update-db=main" }) `
89-
$(if ("${{ inputs.db_daily }}" -eq "true") { "--update-db=daily" })
90-
${{ env.CLAMAV_WIN_VERSION }}\clamd.exe --install-service
85+
$clamavDir = Join-Path $env:RUNNER_TEMP $env:CLAMAV_WIN_VERSION
86+
$clamavZipFilePath = Join-Path $env:RUNNER_TEMP clamav.zip
87+
Invoke-WebRequest -Uri "https://www.clamav.net/downloads/production/$env:CLAMAV_WIN_VERSION.zip" -OutFile $clamavZipFilePath
88+
Expand-Archive -Path $clamavZipFilePath -DestinationPath $env:RUNNER_TEMP
89+
Copy-Item clamd.conf -Destination $clamavDir
90+
Copy-Item freshclam.conf -Destination $clamavDir
91+
& "$clamavDir\freshclam.exe" -F --update-db=bytecode `
92+
$(if ($env:DB_MAIN -eq "true") { "--update-db=main" }) `
93+
$(if ($env:DB_DAILY -eq "true") { "--update-db=daily" })
94+
& "$clamavDir\clamd.exe" --install-service
9195
net start clamd

0 commit comments

Comments
 (0)