summaryrefslogtreecommitdiff
path: root/bbb_setup.sh
blob: 42e008d6bcb4873525e429119ffe5b599311d840 (plain)
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
#!/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