| 
									
										
										
										
											2018-10-21 13:59:08 +02:00
										 |  |  | CHANNEL=$(shell bash conf-tool.sh read CHANNEL) | 
					
						
							|  |  |  | ENV=$(shell bash conf-tool.sh read ENV) | 
					
						
							|  |  |  | DEVICE_IP=$(shell bash conf-tool.sh read DEVICE_IP) | 
					
						
							|  |  |  | DEVICE_USERNAME=$(shell bash conf-tool.sh read DEVICE_USERNAME) | 
					
						
							|  |  |  | DEVICE_PORT=$(shell bash conf-tool.sh read DEVICE_PORT) | 
					
						
							|  |  |  | USER_KEY=$(shell bash conf-tool.sh read USER_KEY) | 
					
						
							|  |  |  | USER_EMAIL=$(shell bash conf-tool.sh read USER_EMAIL) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | all: | 
					
						
							| 
									
										
										
										
											2018-08-10 16:02:05 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | clean: | 
					
						
							| 
									
										
										
										
											2018-08-10 17:39:10 +02:00
										 |  |  | 	rm -rf *.img *.model *.manifest snaps | 
					
						
							| 
									
										
										
										
											2018-08-10 16:02:05 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-10 16:17:10 +02:00
										 |  |  | %.model: boards/%.yaml # sign a model file
 | 
					
						
							| 
									
										
										
										
											2018-10-21 13:59:08 +02:00
										 |  |  | 	cat definition.yaml $< | python -c "import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=2)" | sed "s|TIMESTAMP|$(shell date -Iseconds --utc)|g" | snap sign -k "$USER_KEY" > $@ | 
					
						
							| 
									
										
										
										
											2018-08-10 20:24:28 +02:00
										 |  |  | snaps/%: deps/%.yaml | 
					
						
							| 
									
										
										
										
											2018-08-10 17:30:16 +02:00
										 |  |  | 	node build-tool.js --env $(ENV) --channel $(CHANNEL) --board $* | 
					
						
							| 
									
										
										
										
											2018-08-10 20:24:28 +02:00
										 |  |  | %.img: %.model snaps/% $(ENV).cloud-init.yaml # build an image
 | 
					
						
							| 
									
										
										
										
											2018-08-10 17:39:10 +02:00
										 |  |  | 	sudo ubuntu-image snap -o $@ --cloud-init $(ENV).cloud-init.yaml -c $(CHANNEL) $< | 
					
						
							| 
									
										
										
										
											2018-08-10 16:02:05 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | # VM stuff
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | vm.img: amd64.img # make a copy of the newest clean image
 | 
					
						
							|  |  |  | 	cp amd64.img vm.img | 
					
						
							|  |  |  | start: vm.img # launch the image with kvm
 | 
					
						
							|  |  |  | 	kvm -smp 2 -m 1500 -netdev user,id=mynet0,hostfwd=tcp::8022-:22,hostfwd=tcp::8090-:80 -device virtio-net-pci,netdev=mynet0 -drive file=vm.img,format=raw | 
					
						
							|  |  |  | ssh: # ssh into it (don't check the key because that one changes after every rebuild)
 | 
					
						
							| 
									
										
										
										
											2018-10-21 13:59:08 +02:00
										 |  |  | 	ssh $(DEVICE_USERNAME)@$(DEVICE_IP) -p $(DEVICE_PORT) -o StrictHostKeyChecking=no -o GlobalKnownHostsFile=/dev/null -o UserKnownHostsFile=/dev/null |