The existing clamdownloader.pl script does not have any error correction it simply bails out if a downloaded file is not valid and is unable to retry different mirrors if one fails.
This script will retry if a download fails with an http code that is not 404, it will connect to another mirror if retries fail or file not found or if the downloaded file is invalid.
It has options to set the locations for the working and mirror directory as well as user/group ownership for the downloaded files. It uses locking to prevent multiple instances from running at the same time.
- Urllib3 module - https://urllib3.readthedocs.org
- DNS-Python module - https://www.dnspython.org/
$ clamavmirror -h
Usage: clamavmirror [options]
Options:
-h, --help show this help message and exit
-a HOSTNAME, --hostname=HOSTNAME
ClamAV source server hostname
-r TXTRECORD, --text-record=TXTRECORD
ClamAV Updates TXT record
-w WORKDIR, --work-directory=WORKDIR
Working directory
-d MIRRORDIR, --mirror-directory=MIRRORDIR
The mirror directory
-u USER, --user=USER Change file owner to this user
-g GROUP, --group=GROUP
Change file group to this group
-l LOCKDIR, --locks-directory=LOCKDIR
Lock files directory
$ clamavmirror -w ~/tmp/clamavtmp/ \
-d ~/tmp/clamavmirror/ -u andrew -g staff -a db.za.clamav.net \
-l ~/Downloads/
Install from PyPi
pip install clamavmirror
Install from Githib
git clone https://github.com/akissa/clamavmirror.git
cd clamavmirror
python setup.py install
- Fork it (https://github.com/akissa/clamavmirror/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
All code is licensed under the MPLv2 License.