-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.deploy
67 lines (59 loc) · 1.68 KB
/
Makefile.deploy
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
ssh = ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=ERROR
ifneq ($(filter deploy% test%, $(MAKECMDGOALS)),)
sync_mode = none
endif
-include keyfile
-include ip-addresses
payload = root@$(payload_ip)
qbkit = root@$(qbkit_ip) -o IdentityFile=$(keyfile)
.PHONY: deploy-client
deploy-client: cleanall
tar --exclude-vcs --exclude={bin,tmp,.build,.*.sw*} -cz . | $(ssh) $(qbkit) ' \
set -xe; \
export TERM=$(TERM); \
rm -rf -- pi-cam-demo; \
mkdir -- pi-cam-demo; \
tar -C pi-cam-demo -xz; \
cd pi-cam-demo; \
make -B o=$(o); \
if ! [ -e /etc/systemd/system/picam-test.service ]; then \
cp systemd/client.service /etc/systemd/system/picam-test.service; \
fi; \
systemctl daemon-reload; \
'
.PHONY: deploy-server
deploy-server: cleanall
tar --exclude-vcs --exclude={bin,tmp,.build,.*.sw*} -cz . | $(ssh) $(payload) ' \
set -xe; \
export TERM=$(TERM); \
rm -rf -- pi-cam-demo; \
mkdir -- pi-cam-demo; \
tar -C pi-cam-demo -xz; \
cd pi-cam-demo; \
make -B o=$(o); \
if ! [ -e /etc/systemd/system/picam-test.service ]; then \
cp systemd/server.service /etc/systemd/system/picam-test.service; \
fi; \
systemctl daemon-reload; \
systemctl restart picam-test; \
'
.PHONY: test-real
test-real:
$(ssh) $(qbkit) ' \
set -xe; \
export TERM=$(TERM); \
cp pi-cam-demo/bin/program /qbkit/bin/pi-cam/; \
chown qbkit:qbkit /qbkit/bin/pi-cam/program; \
systemctl restart qbuser_capture-image; \
sleep 2; \
systemctl status -n 30 qbuser_capture-image; \
'
.PHONY: test-test
test-test:
$(ssh) $(qbkit) ' \
set -xe; \
export TERM=$(TERM); \
systemctl restart picam-test; \
sleep 2; \
systemctl status -n 30 picam-test; \
'