]> git.plutz.net Git - blast/commitdiff
Cadus life Sensor plugins
authorPaul Hänsch <paul@plutz.net>
Thu, 5 Sep 2019 09:08:32 +0000 (11:08 +0200)
committerPaul Hänsch <paul@plutz.net>
Thu, 5 Sep 2019 09:08:32 +0000 (11:08 +0200)
modules/remo2hbo.mk [new file with mode: 0644]

diff --git a/modules/remo2hbo.mk b/modules/remo2hbo.mk
new file mode 100644 (file)
index 0000000..e4c3a2d
--- /dev/null
@@ -0,0 +1,113 @@
+PACKAGES += chromium-browser ssh bridge-utils dnsmasq iptables make nmap openbsd-inetd bluez-tools
+hostname := oktopus
+users += oktopus
+
+nodm_user := oktopus
+webui := http://localhost/
+include modules/nodm.mk
+
+define RPICONFIG +=
+
+dtoverlay=w1-gpio
+dtparam=spi=on
+dtoverlay=mcp3008:spi0-0-present,spi0-32768-speed
+
+endef
+
+export oktopus_dnsmasq oktopus_btnap oktopus_eth oktopus_rclocal
+
+define oktopus_dnsmasq :=
+listen-address=192.168.82.1
+bind-interfaces
+
+dhcp-authoritative
+dhcp-range=192.168.82.16,192.168.82.254,48h
+
+address=/#/192.168.82.1
+endef
+
+define oktopus_eth :=
+auto eth0
+allow-hotplug eth0
+iface eth0 inet static
+       address 192.168.83.1
+       netmask 255.255.255.0
+endef
+
+define oktopus_btnap :=
+auto br0
+iface br0 inet static
+        address 192.168.82.1
+        netmask 255.255.255.0
+        bridge_ports    none
+        bridge_fd       5
+        bridge_stp      no
+endef
+
+define oktopus_rclocal :=
+#!/bin/sh
+
+modprobe w1-gpio pullup=1
+modprobe w1-therm
+
+while ! hciconfig hci0; do sleep 1; done
+bt-network -s nap br0 &
+hciconfig hci0 up
+hciconfig hci0 sspmode 1
+hciconfig hci0 piscan
+
+while sleep 5; do
+  bt-device -l \
+  | grep -oE '[0-9A-F:]{17}' \
+  | while read mac; do
+    bt-device --set "$$mac" Trusted 1
+  done
+done &
+
+/srv/gummikraken/hatch.sh &
+endef
+
+
+_config: ${CFGROOT}/etc/dnsmasq.conf ${CFGROOT}/etc/network/interfaces.d/btnap ${CFGROOT}/etc/rc.local
+_config: ${CFGROOT}/etc/inetd.conf ${CFGROOT}/etc/network/interfaces.d/eth
+_config: ${CFGROOT}/usr/local/bin/teesock ${CFGROOT}/srv/gummikraken
+
+${CFGROOT}/etc/dnsmasq.conf: ${CFGROOT}
+       printf '%s\n' "$$oktopus_dnsmasq" >"$@"
+
+${CFGROOT}/etc/network/interfaces.d/btnap: ${CFGROOT}
+       mkdir -p "$(dir $@)"
+       printf '%s\n' "$$oktopus_btnap" >"$@"
+
+${CFGROOT}/etc/network/interfaces.d/eth: ${CFGROOT}
+       mkdir -p "$(dir $@)"
+       printf '%s\n' "$$oktopus_eth" >"$@"
+
+${CFGROOT}/etc/rc.local: ${CFGROOT}
+       # chroot "$${CFGROOT}" systemctl enable rc-local
+       printf '%s\n' "$$oktopus_rclocal" >"$@"
+       chmod 755 "$@"
+
+${CFGROOT}/usr/local/bin/teesock: teesock/teesock.arm ${CFGROOT}
+       cp "$<" "$@"
+
+${CFGROOT}/srv/gummikraken: gummikraken/ ${CFGROOT}
+       cp -au "$</." "$@"
+
+.PHONY: gummikraken_clone
+gummikraken_clone:
+       [ -d gummikraken/.git ] || git clone https://git.tools.f4.htw-berlin.de/phaensch/gummikraken.git "gummikraken/"
+
+gummikraken/: gummikraken_clone
+       -git -C $@ submodule init
+       git -C $@ submodule update --remote
+
+teesock/teesock.arm: teesock/
+       make -C $< "$(notdir $@)"
+       chmod 755 "$@"
+
+teesock/:
+       git clone https://git.tools.f4.htw-berlin.de/phaensch/teesock.git "$@"
+
+${CFGROOT}/etc/inetd.conf: gummikraken/
+       cp "$</inetd.conf" "$@"