-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·66 lines (53 loc) · 1.8 KB
/
setup.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
#!/bin/bash
# This script sets up the BB green/black for use with Grove modules
# Functions for y/n interactivity
response_yN () {
read -r -p "${1:-Continue? [y/N]} " response
case $response in
[yY][eE][sS]|[yY])
true
;;
*)
false
;;
esac
}
response_Yn () {
read -r -p "${1:-Continue? [Y/n]} " response
case $response in
[nN][oO]|[nN])
false
;;
*)
true
;;
esac
}
# Script starts here
echo "Testing internet connection..."
case "$(curl -s --max-time 5 -I http://google.om | head -1 | sed 's/^[^ ]* *\([0-9]\).*/\1/')" in
[23]) echo "Internet connection (HTTP) is up";;
5) echo "Web proxy seems to be blocking internet access."
response_yN "Continue anyway? [y/N]" || exit;;
*) echo "Network appears to be down or lagging."
response_yN "Continue anyway? [y/N]" || exit;;
esac
echo "Setting up BeagleBone..."
# set date and time
sudo ntpdate pool.ntp.org
# Update kernel (may require a reboot, untested)
# Uncomment the line below to update the kernel (may improve WiFi performance)
#sudo /opt/scripts/tools/update_kernel.sh
# Install Adafruit_BBIO for python i/o capability
sudo apt-get update
sudo apt-get install build-essential python-dev python-setuptools python-pip python-smbus -y
sudo pip install Adafruit-BBIO
# Install ssh server to allow ssh in over WiFi
sudo apt-get install openssh-server
# Enable UART
sudo echo "cape_enable=capemgr.enable_partno=BB-UART2" >> /boot/uEnv.txt # UART 2 only
#sudo echo "cape_enable=capemgr.enable_partno=BB-UART1,BB-UART2" >> /boot/uEnv.txt # UART 1 and 2
echo "Installations complete!"
# Reboot to apply changes
echo "Reboot required for changes to take effect."
response_Yn "Reboot now? [Y/n]" && sudo reboot