-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·86 lines (70 loc) · 2.74 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
set -e
set -x
case $(uname -m) in
aarch64) echo "Cannot install on 64 bit OS due to missing legacy camera support"; exit;;
esac
#sudo apt-get update
#sudo apt-get install -y vim
#sudo apt-get install -y vlc
#sudo apt-get install -y git
#sudo apt-get install -y python3-pip
#sudo apt-get install -y sense-hat
#sudo apt-get install -y libopenjp2-7-dev
#sudo apt-get install -y libatlas-base-dev
#sudo apt-get install -y python3-opencv
#sudo apt-get install -y network-manager dnsmasq
#sudo apt-get install -y sshpass
#sudo apt-get install -y rpicam-apps-lite
#sudo apt install rpi-connect-lite
#sudo apt install python3-picamera2
#sudo systemctl disable dnsmasq
#sudo systemctl enable NetworkManager
#sudo systemctl start NetworkManager
python -m pip install tflite-runtime
python -m pip install Pillow
python -m pip install picamera
python -m pip install numpy
# adjustments to kernel/os options
echo "\n" | sudo tee -a /boot/firmware/config.txt
echo "enable_uart=1\n" | sudo tee -a /boot/firmware/config.txt
echo "dtoverlay=disable-bt\n" | sudo tee -a /boot/firmware/config.txt # needed to get uart on gpio on some pis I think
echo "start_x=1\n" | sudo tee -a /boot/firmware/config.txt # needed to enable the camera
# enable ssh on next boot
sudo touch /boot/ssh
# ensure scripts are executable
chmod a+x *.sh
# TODO: consider `systemctl link` here
# services
sudo install -m 644 "services/interface.service" "/lib/systemd/system/"
sudo systemctl enable interface.service
sudo install -m 644 "services/sensors.service" "/lib/systemd/system/"
sudo systemctl enable sensors.service
# setup wifi access point
echo "\n" | sudo tee -a /etc/dhcpcd.conf
echo "denyinterfaces wlan0\n" | sudo tee -a /etc/dhcpcd.conf
APNAME="WiFiAP"
SSID="stem_club"
KEY="piisgood"
IFNAME=wlan0
sudo nmcli connection add type wifi ifname $IFNAME con-name $APNAME ssid $SSID
sudo nmcli connection modify $APNAME 802-11-wireless.mode ap
sudo nmcli connection modify $APNAME 802-11-wireless.band bg
sudo nmcli connection modify $APNAME ipv4.method shared
sudo nmcli connection modify $APNAME ipv4.addresses 10.0.2.100/24
# Set security
sudo nmcli connection modify $APNAME 802-11-wireless-security.key-mgmt wpa-psk
sudo nmcli connection modify $APNAME 802-11-wireless-security.psk "$KEY"
sudo nmcli connection modify $APNAME 802-11-wireless-security.group ccmp
sudo nmcli connection modify $APNAME 802-11-wireless-security.pairwise ccmp
# Disable WPS
if grep -Fxq "wpa_cli" /home/pi/.bashrc
then
echo "PIN fix already exists"
else
echo -e "wpa_cli wps_ap_pin disable > /dev/null 2>&1" | tee -a /home/pi/.bashrc
echo -e "sed -i '/wpa_cli/d' /home/pi/.bashrc" | tee -a /home/pi/.bashrc
fi
sudo nmcli connection up $APNAME
# reboot
sudo reboot now