/
install.sh
87 lines (73 loc) · 3.36 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
77
78
79
80
81
82
83
84
#copy wpa_supplication.conf to /boot & touch ssh
#prep work requires git, bc, a few other tools if not found
# sudo apt install bc
# sudo apt install git
#1 git clone https://github.com/regularsteven/letslapse.git
#2 sudo sh install.sh
echo "1 Running updates"
sudo apt-get update
echo "2 Running upgrades"
sudo apt-get upgrade
echo "-------------------------------------"
echo "3 Install hostapd"
sudo apt-get install hostapd
echo "4 Install hostapd"
sudo apt-get install dnsmasq
echo "5 Unmask and disable services"
sudo systemctl unmask hostapd
sudo systemctl disable hostapd
sudo systemctl disable dnsmasq
echo "6 Copy hostapd.conf"
sudo cp install/hostapd.conf /etc/hostapd/
echo "7 Updating /etc/default/hostapd"
echo 'DAEMON_CONF="/etc/hostapd/hostapd.conf"' | sudo tee -a /etc/default/hostapd
echo "8 Updating /etc/dnsmasq.conf"
echo '#AutoHotspot Config' | sudo tee -a /etc/dnsmasq.conf
echo '#stop DNSmasq from using resolv.conf' | sudo tee -a /etc/dnsmasq.conf
echo 'no-resolv' | sudo tee -a /etc/dnsmasq.conf
echo '#Interface to use' | sudo tee -a /etc/dnsmasq.conf
echo 'interface=wlan0' | sudo tee -a /etc/dnsmasq.conf
echo 'bind-interfaces' | sudo tee -a /etc/dnsmasq.conf
echo 'dhcp-range=10.0.0.50,10.0.0.150,12h' | sudo tee -a /etc/dnsmasq.conf
echo "-------------------------------------"
echo "9 Updating /etc/dnsmasq.conf"
echo 'nohook wpa_supplicant' | sudo tee -a /etc/dhcpcd.conf
echo "10 Copy autohotspot.service"
sudo cp install/autohotspot.service /etc/systemd/system/
echo "11 Starting autohotspot.service"
sudo systemctl enable autohotspot.service
echo "12 Copy autohotspot script"
sudo cp install/autohotspot /usr/bin/
echo "13 Make autohotspot script executable"
sudo chmod +x /usr/bin/autohotspot
echo "-------------------------------------"
echo "14 installing python / camera dependencies"
sudo apt install python3-pip
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade Pillow
sudo apt-get install python-picamera python3-picamera -y
echo "15 System Stuff - Enable Camera / Disable Bluetooth - Updating /etc/default/hostapd"
echo 'start_x=1' | sudo tee -a /boot/config.txt
echo 'gpu_mem=128' | sudo tee -a /boot/config.txt
echo 'dtoverlay=disable-bt' | sudo tee -a /boot/config.txt
echo 'disable_camera_led=1' | sudo tee -a /boot/config.txt
sudo apt install libopenjp2-7 libopenjp2-7-dev libopenjp2-tools -y
#ideally disable HDMI - need to add this before exit 0 though, not at the end
#echo '/usr/bin/tvservice -o' | sudo tee -a /etc/rc.local
sudo apt install -y libimage-exiftool-perl
echo "16 Copy letslapse.service"
sudo cp install/letslapse.service /etc/systemd/system/
sudo chmod u+rw /etc/systemd/system/letslapse.service
echo "11 Starting and enable letslapse.service"
sudo systemctl enable letslapse.service
sudo systemctl start letslapse.service
echo "See the following logs for further detail:"
echo "tail -f /var/log/syslog for error messages"
echo ""
#echo "16 Start server on boot - Updating /etc/default/hostapd"
#echo 'sudo python3 /home/pi/letslapse/letslapse_server.py' | sudo tee -a /etc/profile
#initially considered loading the streamer on start-up, but this adds overhead and should only be called when required
#echo 'sudo python3 /home/pi/letslapse/streamer.py' | sudo tee -a /etc/profile
echo "Finished. On reboot, if no network is found, a hotspot will be created."
echo "In some instances, crashes will take place. Try "
echo "sudo rpi-update"