]> git.plutz.net Git - blast/blob - modules/remo2hbo.mk
e4c3a2d55074b85e5bf0565d7552f940fc5c2844
[blast] / modules / remo2hbo.mk
1 PACKAGES += chromium-browser ssh bridge-utils dnsmasq iptables make nmap openbsd-inetd bluez-tools
2 hostname := oktopus
3 users += oktopus
4
5 nodm_user := oktopus
6 webui := http://localhost/
7 include modules/nodm.mk
8
9 define RPICONFIG +=
10
11 dtoverlay=w1-gpio
12 dtparam=spi=on
13 dtoverlay=mcp3008:spi0-0-present,spi0-32768-speed
14
15 endef
16
17 export oktopus_dnsmasq oktopus_btnap oktopus_eth oktopus_rclocal
18
19 define oktopus_dnsmasq :=
20 listen-address=192.168.82.1
21 bind-interfaces
22
23 dhcp-authoritative
24 dhcp-range=192.168.82.16,192.168.82.254,48h
25
26 address=/#/192.168.82.1
27 endef
28
29 define oktopus_eth :=
30 auto eth0
31 allow-hotplug eth0
32 iface eth0 inet static
33         address 192.168.83.1
34         netmask 255.255.255.0
35 endef
36
37 define oktopus_btnap :=
38 auto br0
39 iface br0 inet static
40         address 192.168.82.1
41         netmask 255.255.255.0
42         bridge_ports    none
43         bridge_fd       5
44         bridge_stp      no
45 endef
46
47 define oktopus_rclocal :=
48 #!/bin/sh
49
50 modprobe w1-gpio pullup=1
51 modprobe w1-therm
52
53 while ! hciconfig hci0; do sleep 1; done
54 bt-network -s nap br0 &
55 hciconfig hci0 up
56 hciconfig hci0 sspmode 1
57 hciconfig hci0 piscan
58
59 while sleep 5; do
60   bt-device -l \
61   | grep -oE '[0-9A-F:]{17}' \
62   | while read mac; do
63     bt-device --set "$$mac" Trusted 1
64   done
65 done &
66
67 /srv/gummikraken/hatch.sh &
68 endef
69
70
71 _config: ${CFGROOT}/etc/dnsmasq.conf ${CFGROOT}/etc/network/interfaces.d/btnap ${CFGROOT}/etc/rc.local
72 _config: ${CFGROOT}/etc/inetd.conf ${CFGROOT}/etc/network/interfaces.d/eth
73 _config: ${CFGROOT}/usr/local/bin/teesock ${CFGROOT}/srv/gummikraken
74
75 ${CFGROOT}/etc/dnsmasq.conf: ${CFGROOT}
76         printf '%s\n' "$$oktopus_dnsmasq" >"$@"
77
78 ${CFGROOT}/etc/network/interfaces.d/btnap: ${CFGROOT}
79         mkdir -p "$(dir $@)"
80         printf '%s\n' "$$oktopus_btnap" >"$@"
81
82 ${CFGROOT}/etc/network/interfaces.d/eth: ${CFGROOT}
83         mkdir -p "$(dir $@)"
84         printf '%s\n' "$$oktopus_eth" >"$@"
85
86 ${CFGROOT}/etc/rc.local: ${CFGROOT}
87         # chroot "$${CFGROOT}" systemctl enable rc-local
88         printf '%s\n' "$$oktopus_rclocal" >"$@"
89         chmod 755 "$@"
90
91 ${CFGROOT}/usr/local/bin/teesock: teesock/teesock.arm ${CFGROOT}
92         cp "$<" "$@"
93
94 ${CFGROOT}/srv/gummikraken: gummikraken/ ${CFGROOT}
95         cp -au "$</." "$@"
96
97 .PHONY: gummikraken_clone
98 gummikraken_clone:
99         [ -d gummikraken/.git ] || git clone https://git.tools.f4.htw-berlin.de/phaensch/gummikraken.git "gummikraken/"
100
101 gummikraken/: gummikraken_clone
102         -git -C $@ submodule init
103         git -C $@ submodule update --remote
104
105 teesock/teesock.arm: teesock/
106         make -C $< "$(notdir $@)"
107         chmod 755 "$@"
108
109 teesock/:
110         git clone https://git.tools.f4.htw-berlin.de/phaensch/teesock.git "$@"
111
112 ${CFGROOT}/etc/inetd.conf: gummikraken/
113         cp "$</inetd.conf" "$@"