forked from abersailbot/dewi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
host-provision
executable file
·59 lines (46 loc) · 1.4 KB
/
host-provision
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
set -xe
apt-get -y update
apt-get -y install \
git \
hostapd \
isc-dhcp-server \
picocom \
python-dev \
python-setuptools \
screen \
tmux \
unzip \
vim-nox \
wget \
gpsd \
gpsd-clients \
python-gps \
fish
# using python-pip installed from apt has some pretty bad issues on the current
# version of raspbian.
easy_install pip
pip install -U platformio
cp ./etc/boatd-config.yaml /etc
cp ./etc/boatd.service /etc/systemd/system/boatd.service
systemctl daemon-reload
cp ./etc/51-gps.rules /etc/udev/rules.d/
cp ./etc/52-arduino.rules /etc/udev/rules.d/
cp ./etc/10-network-device.rules /etc/udev/rules.d/
udevadm control --reload-rules
cp ./etc/hostname /etc/hostname
cp ./etc/motd /etc/motd
cp ./etc/dhcpd.conf /etc/dhcp/dhcpd.conf
cp ./etc/isc-dhcp-server /etc/default/isc-dhcp-server
cp ./etc/interfaces /etc/network/interfaces
cp ./etc/hostapd /etc/default/hostapd
cp ./etc/sysctl.conf /etc/sysctl.conf
mkdir -p /etc/hostapd
cp ./etc/hostapd.conf /etc/hostapd/hostapd.conf
sed -i "s/PASSWORD/$(cat ./etc/password)/g" /etc/network/interfaces
ifconfig wlan0 192.168.42.1
sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
iptables -t nat -A POSTROUTING -o wlan1 -j MASQUERADE
iptables -A FORWARD -i wlan1 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i wlan0 -o wlan1 -j ACCEPT
iptables-save > /etc/iptables.ipv4.nat