-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
76 lines (62 loc) · 1.92 KB
/
install.sh
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/sh
# This is the source install script
#
# Usage: curl sourcewifi.com/install.sh | sudo sh
#
# Currently supports:
# Raspbian 4.4
#
# TODO: update for versioning
install_requirements () {
sudo apt-get -y update
PGK_OK=$(dpkg -s nodejs | grep "install ok installed")
if [ "" = "$PKG_OK" ]; then
sudo curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get -y install nodejs
fi
PGK_OK=$(dpkg -s npm | grep "install ok installed")
if [ "" = "$PKG_OK" ]; then
sudo curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get -y install npm
fi
PGK_OK=$(dpkg -s hostpad | grep "install ok installed")
if [ "" = "$PKG_OK" ]; then
sudo apt-get -y install hostapd
fi
PGK_OK=$(dpkg -s dnsmasq | grep "install ok installed")
if [ "" = "$PKG_OK" ]; then
sudo apt-get -y install dnsmasq
fi
}
install_source () {
git clone https://github.com/sourcenetworks/source
sudo cp source/conf/dnsmasq.conf /etc/dnsmasq.conf
sudo cp source/conf/hosts /etc/hosts
sudo cp source/conf/hostapd.conf /etc/hostapd/hostapd.conf
sudo cp source/conf/interfaces /etc/network/interfaces
sudo npm --prefix ./source/lib/source-firewall install
(cd source/lib/source-firewall; sudo npm link)
(cd source/server; sudo npm link source-firewall)
sudo npm --prefix ./source/server install
# IPv4 packet forwarding
sudo sed -i '/#net.ipv4.ip_forward=1/c\net.ipv4.ip_forward=1' /etc/sysctl.conf
# hostpad daemon
sudo sed -i '/#DAEMON_CONF=""/c\DAEMON_CONF="/etc/hostapd/hostapd.conf"' /etc/default/hostapd
}
start_services () {
sudo service dnsmasq start
sudo service hostapd start
sudo ifconfig wlan0 192.168.24.1
sudo service dnsmasq restart
sudo service hostapd restart
}
main () {
# TODO: fix
PGK_OK=$(dpkg -s hostapd | grep "install ok installed")
if [ "" = "$PKG_OK" ]; then
install_requirements
fi
install_source
start_services
}
main