-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild
executable file
·102 lines (88 loc) · 3.28 KB
/
build
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#! /bin/bash
echo "Welcome to the BlockyTalky installer. Please ensure you have Internet connectivity before running this script. NOTE: this script will reboot your Raspberry Pi after completion."
echo " "
echo "Press ENTER to continue installation."
read
echo "Would you like to set a hostname? (y/n)"
read host
if [ "$host" == "y" ] || [ "$host" == "Y" ]; then
echo "Enter a hostname: "
read hostname
fi
echo "Would you like to set up your wireless connection? (y/n)"
read setup
if [ "$setup" == "y" ] || [ "$setup" == "Y" ]; then
echo "Enter SSID:"
read ssid
echo "Enter Password (blank for none):"
read password
fi
echo "Installing dependencies..."
sudo apt-get update
sudo apt-get install -y python-pip git libi2c-dev python-serial python-rpi.gpio i2c-tools python-smbus avahi-daemon
cd ~
sudo pip install flask
sudo pip install tornado
sudo pip install jsonpickle
sudo pip install pyttsx
sudo pip install pyOSC
sudo pip install websocket-client
sudo pip install pika
wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.2.2/rabbitmq-server_3.2.2-1_all.deb
sudo dpkg -i rabbitmq-server_3.2.2-1_all.deb
sudo rabbitmq-plugins enable rabbitmq_web_stomp
sudo rabbitmqctl set_policy TTL ".*" '{"message-ttl":3000}' --apply-to queues
cd ~
wget https://github.com/aeberhardo/phantomjs-linux-armv6l/archive/master.zip
unzip master.zip
mv phantomjs-linux-armv6l-master/ phantomjs/
cd phantomjs/
bunzip2 *.bz2 && tar xf *.tar
cd phantomjs-1.9.0-linux-armv6l/
cp -r * ..
cd ..
rm -r -f phantomjs-1.9.0-linux-armv6l/
cd ~
git clone git://git.drogon.net/wiringPi
cd wiringPi
./build
echo "Setting up serial pins..."
gpio load i2c 10
sudo echo init_uart_clock=32000000 >> /boot/config.txt
sudo sed -i -e 's,T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100,#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 t100,' /etc/inittab
sudo sed -i -e 's/console=ttyAMA0,115200 kgdboc=ttyAMA0,115200//g' /boot/cmdline.txt
sudo sed -i -e 's,blacklist i2c-bcm2708,#blacklist i2c-bcm2708,' /etc/modprobe.d/raspi-blacklist.conf
sudo echo i2c-dev >> /etc/modules
echo "Installing customizations..."
sudo sed -i -e 's/XKBLAYOUT="gb"/XKBLAYOUT="us"/g' /etc/default/keyboard
sudo sed -i -e 's,exit 0,sh /home/pi/blockytalky/start.sh,' /etc/rc.local
sudo echo exit 0 >> /etc/rc.local
if [ "$setup" == "y" ] || [ "$setup" == "Y" ]; then
if [ -n "$password" ]; then
sudo echo "network={" >> /etc/wpa_supplicant/wpa_supplicant.conf
sudo echo "ssid=\"$ssid\"" >> /etc/wpa_supplicant/wpa_supplicant.conf
sudo echo "key_mgmt=WPA-PSK" >> /etc/wpa_supplicant/wpa_supplicant.conf
sudo echo "psk="\"$password\""" >> /etc/wpa_supplicant/wpa_supplicant.conf
sudo echo "}" >> /etc/wpa_supplicant/wpa_supplicant.conf
else
sudo echo "network={" >> /etc/wpa_supplicant/wpa_supplicant.conf
sudo echo "ssid=\"$ssid\"" >> /etc/wpa_supplicant/wpa_supplicant.conf
sudo echo "key_mgmt=NONE" >> /etc/wpa_supplicant/wpa_supplicant.conf
sudo echo "}" >> /etc/wpa_supplicant/wpa_supplicant.conf
fi
fi
if [ "$host" == "y" ] || [ "$host" == "Y" ]; then
sudo echo $hostname > /etc/hostname
sudo sed -i -e "s/raspberrypi/$hostname/g" /etc/hosts
fi
echo "BlockyTalky installed! Restart required. System restart in 5 seconds (press CTRL-C to cancel)"
sleep 1
echo "4"
sleep 1
echo "3"
sleep 1
echo "2"
sleep 1
echo "1"
sleep 1
sudo shutdown -r now