summaryrefslogtreecommitdiff
path: root/bbb_setup.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bbb_setup.sh')
-rwxr-xr-xbbb_setup.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/bbb_setup.sh b/bbb_setup.sh
new file mode 100755
index 0000000..42e008d
--- /dev/null
+++ b/bbb_setup.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+# Change based upon device specifics
+IFACE_BB=enp0s20f0u5
+IFACE_SELF=wlan0
+EXE=ads
+
+echo "Compiling Executeables"
+vagrant up
+vagrant ssh << EOF
+ cmake /vagrant;
+ cmake --build .;
+ mkdir -p build
+ cp -r out/* /vagrant/build/
+EOF
+
+echo "Forwarding Traffic to Beaglebone"
+# Forwards all internet traffic requested by beaglebone to proper interface
+sudo sh -c "ip link set $IFACE_BB"
+sudo sh -c "dhclient $IFACE_BB"
+
+sudo sh -c "iptables --table nat --append POSTROUTING --out-interface $IFACE_SELF -j MASQUERADE"
+sudo sh -c "iptables --append FORWARD --in-interface $IFACE_BB -j ACCEPT"
+sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
+
+echo "Copying Executeables to Beaglebone"
+scp -r build/* [email protected]:~/;
+rm -r build
+
+echo "Running Main Program"
+ssh [email protected] /bin/bash << EOF
+ ./$EXE;
+EOF