From 81572cc5e6008c1816d8b713bfa368341635acec Mon Sep 17 00:00:00 2001 From: Thorsten Blum Date: Thu, 4 Apr 2024 17:18:14 +0200 Subject: [PATCH] Install ClamAV in temporary directory --- action.yml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/action.yml b/action.yml index c30d466..fdd15fd 100644 --- a/action.yml +++ b/action.yml @@ -78,14 +78,20 @@ runs: if: runner.os == 'Windows' env: CLAMAV_WIN_VERSION: clamav-1.0.4.win.x64 + DB_MAIN: ${{ inputs.db_main }} + DB_DAILY: ${{ inputs.db_daily }} shell: pwsh run: | - curl -L -o clamav.zip https://www.clamav.net/downloads/production/${{ env.CLAMAV_WIN_VERSION }}.zip - tar -xf clamav.zip - cp clamd.conf ${{ env.CLAMAV_WIN_VERSION }} - cp freshclam.conf ${{ env.CLAMAV_WIN_VERSION }} - ${{ env.CLAMAV_WIN_VERSION }}\freshclam.exe -F --update-db=bytecode ` - $(if ("${{ inputs.db_main }}" -eq "true") { "--update-db=main" }) ` - $(if ("${{ inputs.db_daily }}" -eq "true") { "--update-db=daily" }) - ${{ env.CLAMAV_WIN_VERSION }}\clamd.exe --install-service + $clamavInstallDir = Join-Path $env:RUNNER_TEMP $env:CLAMAV_WIN_VERSION + $clamavZipFilePath = Join-Path $env:RUNNER_TEMP clamav.zip + Invoke-WebRequest -Uri "https://www.clamav.net/downloads/production/$env:CLAMAV_WIN_VERSION.zip" -OutFile $clamavZipFilePath + Expand-Archive -Path $clamavZipFilePath -DestinationPath $env:RUNNER_TEMP + # mkdir -p $clamavInstallDir + # tar -xf $clamavZipFilePath -C $env:RUNNER_TEMP + cp clamd.conf $clamavInstallDir + cp freshclam.conf $clamavInstallDir + & "$clamavInstallDir\freshclam.exe" -F --update-db=bytecode ` + $(if ($env:DB_MAIN -eq "true") { "--update-db=main" }) ` + $(if ($env:DB_DAILY -eq "true") { "--update-db=daily" }) + & "$clamavInstallDir\clamd.exe" --install-service net start clamd