Skip to content

Commit

Permalink
simplyfying the freschlam switch logic
Browse files Browse the repository at this point in the history
  • Loading branch information
a5rar committed Nov 21, 2024
1 parent ba200a1 commit 8830ed5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
3 changes: 1 addition & 2 deletions clamav/freshclam.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 3 additions & 5 deletions scripts/wrapper-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8830ed5

Please sign in to comment.