forked from sdelrio/rpi-hostap
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
75 lines (73 loc) · 2.23 KB
/
Makefile
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
65
66
67
68
69
70
71
72
73
74
75
IMGNAME = rpi-hostap2
VERSION = $(shell grep "ENV VERSION" Dockerfile| awk 'NF>1{print $$NF}')
SUBNET = 192.168.254.0
APADDR = 192.168.254.1
.PHONY: all build test taglatest
all: build test
build:
@docker build -t $(IMGNAME):$(VERSION) --rm . && echo Buildname: $(IMGNAME):$(VERSION)
test:
@sudo /sbin/ifconfig wlan0 $(APADDR)/24 down
@sudo /sbin/ifconfig wlan0 $(APADDR)/24 up
sudo docker run -t \
--name $(IMGNAME)_test \
-e INTERFACE=wlan0 \
-e SSID=testssid \
-e AP_ADDR=$(APADDR) \
-e SUBNET=$(SUBNET) \
-e SSID=testssid \
-e CHANNEL=6 \
-e WPA_PASSPHRASE=passw0rd \
-e OUTGOINGS=eth0 \
--entrypoint=/bin/test.sh \
--privileged \
--net host \
--rm \
$(IMGNAME):$(VERSION) \
/bin/test.sh || sudo docker stop $(IMGNAME)_test && docker rm $(IMGNAME)_test
run:
@sudo /sbin/ifconfig wlan0 $(APADDR)/24 down
@sudo /sbin/ifconfig wlan0 $(APADDR)/24 up
sudo docker run -d -t \
--name $(IMGNAME)_run \
-e INTERFACE=wlan0 \
-e CHANNEL=6 \
-e SSID=runssid \
-e AP_ADDR=$(APADDR) \
-e SUBNET=$(SUBNET) \
-e WPA_PASSPHRASE=passw0rd \
-e OUTGOINGS=eth0 \
--privileged \
--net host \
$(IMGNAME):$(VERSION)
stop:
@docker stop $(IMGNAME)_test || docker stop $(IMGNAME)_run || docker stop $(IMGNAME)_shell
@docker rm $(IMGNAME)_test || docker rm $(IMGNAME)_run || docker rm $(IMGNAME)_shell
shell:
@sudo /sbin/ifconfig wlan0 $(APADDR)/24 down
@sudo /sbin/ifconfig wlan0 $(APADDR)/24 up
@sudo docker run -t \
--name $(IMGNAME)_shell \
-e INTERFACE=wlan0 \
-e SSID=shellssid \
-e AP_ADDR=$(APADDR) \
-e SUBNET=$(SUBNET) \
-e WPA_PASSPHRASE=passw0rd \
-e OUTGOINGS=eth0 \
--privileged \
--net host \
-ti --entrypoint=/bin/sh \
--rm \
$(IMGNAME):$(VERSION) || sudo docker stop $(IMGNAME)_shell && docker rm $(IMGNAME)_shell
clean:
@docker ps -a |grep rpi-hostap |cut -f 1 -d' '|xargs -P1 -i docker stop {}
@docker ps -a |grep rpi-hostap |cut -f 1 -d' '|xargs -P1 -i docker rm {}
@docker rmi $(IMGNAME):$(VERSION)
taglatest:
docker tag $(IMGNAME):$(VERSION) $(IMGNAME):lastest
docker tag $(IMGNAME):$(VERSION) pavelsr/$(IMGNAME):$(VERSION)
docker tag $(IMGNAME):$(VERSION) pavelsr/$(IMGNAME):latest
push:
docker push pavelsr/$(IMGNAME)
docker push pavelsr/$(IMGNAME):$(VERSION)
release: taglatest push