From 8830ed578de10038150bd8aa705c434352292e93 Mon Sep 17 00:00:00 2001 From: Asrar hussain Date: Thu, 21 Nov 2024 13:59:07 +0000 Subject: [PATCH] simplyfying the freschlam switch logic --- clamav/freshclam.conf | 3 +-- scripts/wrapper-entrypoint.sh | 8 +++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/clamav/freshclam.conf b/clamav/freshclam.conf index c39d281..5b374c9 100644 --- a/clamav/freshclam.conf +++ b/clamav/freshclam.conf @@ -113,8 +113,7 @@ ScriptedUpdates yes # and ScriptedUpdates. It can be used multiple times to provide # fall-back mirrors. # Default: disabled -PrivateMirror mirror1.example.com -#PrivateMirror mirror2.example.com +#PrivateMirror mirror1.example.com # Number of database checks per day. # Default: 12 (every two hours) diff --git a/scripts/wrapper-entrypoint.sh b/scripts/wrapper-entrypoint.sh index 36539d7..ba7b40c 100644 --- a/scripts/wrapper-entrypoint.sh +++ b/scripts/wrapper-entrypoint.sh @@ -4,11 +4,9 @@ ls -ld /var/lib/clamav # Check if MIRROR_URL is defined and not empty if [ -n "$MIRROR_URL" ] then - # MIRROR_URL is defined, replace all the PrivateMirror URLs in the freshclam.conf file - sed -i 's|PrivateMirror .*|PrivateMirror '"$MIRROR_URL"'|g' /etc/clamav/freshclam.conf -else - # MIRROR_URL is not defined, comment out all the PrivateMirror lines - sed -i 's|^PrivateMirror|##&|' /etc/clamav/freshclam.conf + # MIRROR_URL is defined + # Uncomment the PrivateMirror line and replace mirror1.example.com with the provided MIRROR_URL + sed -i 's|#PrivateMirror mirror1.example.com|PrivateMirror '"$MIRROR_URL"'|g' /etc/clamav/freshclam.conf fi # Execute the original entrypoint script