forked from data-prep-kit/data-prep-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (43 loc) · 2.37 KB
/
Makefile
File metadata and controls
64 lines (43 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Define the root of the local git clone for the common rules to be able
# know where they are running from.
REPOROOT=../../../..
# Include a library of common .transform.* targets which most
# transforms should be able to reuse. However, feel free
# to override/redefine the rules below.
include $(REPOROOT)/transforms/.make.transforms
TRANSFORM_NAME=malware
OS := $(shell uname -s)
ifeq ($(OS),Darwin)
venv:: .transforms.python-venv
@./install_clamd_mac.sh
@echo -e "if [ ! -e /var/run/clamav/clamd.ctl ]; then\n clamd --config-file=\$$(brew --prefix)/etc/clamav/clamd.conf\nfi" >> ./venv/bin/activate
@sed -i '' -e "s#deactivate () {#deactivate () {\nps aux | grep \"[c]lamd --config-file=\$$(brew --prefix)/etc/clamav/clamd.conf\" | awk '{print \$$2}' | xargs kill\nrm -f /var/run/clamav/clamd.ctl#" ./venv/bin/activate
else
venv:: .transforms.python-venv
@sudo mkdir -p /var/run/clamav && sudo chmod 777 /var/run/clamav
@$(DOCKER) build --target clamav-local -f Dockerfile -t clamav-local:latest .
@echo -e "$(DOCKER) run -d --name clamav -v /var/run/clamav:/var/run/clamav clamav-local:latest" >> ./venv/bin/activate
@echo -e "retry=0\nuntil python -c \"import clamd; clamd.ClamdUnixSocket().ping()\" > /dev/null 2>&1; do\n sleep 3\n retry=\$$((retry+1))\n if [ \$$retry -gt 20 ]; then break; fi\ndone" >> ./venv/bin/activate
@sed -i -e "s/deactivate () {/deactivate () {\nfor c in \`$(DOCKER) ps -a | grep clamav | cut -f1 -d ' '\`; do $(DOCKER) rm -f -v \$$c; done/" ./venv/bin/activate
endif
test:: .transforms.python-test
clean:: .transforms.clean
image:: .transforms.python-image
build:: build-dist image
publish: publish-image
publish-image:: .transforms.publish-image-python
setup:: .transforms.setup
# distribution versions is the same as image version.
set-versions:
$(MAKE) TRANSFORM_PYTHON_VERSION=$(MALWARE_PYTHON_VERSION) TOML_VERSION=$(MALWARE_PYTHON_VERSION) .transforms.set-versions
build-dist:: .defaults.build-dist
publish-dist: .defaults.publish-dist
test-src:: .transforms.test-src
test-image:: .transforms.python-test-image
run-cli-sample: .transforms.run-cli-python-sample
run-local-sample: .transforms.run-local-sample
run-local-python-sample: .transforms.run-local-python-sample
minio-start: .minio-start
kind-load-image:: .transforms.kind-load-image
docker-load-image: .defaults.docker-load-image
docker-save-image: .defaults.docker-save-image