-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
37 lines (31 loc) · 1.3 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
#!/bin/bash
# This script is used for a simple installation
# of the dashcam application on a e.g. a Raspberry
# PI Zero.
# You will probably asked for sudo password, if you
# did not have the default settings of Raspberry PI
# OS.
# Please feel free to adjust to your needs, e.g.
# adding some mount info like sda1 for external usb sticks
DASHCAM_ROOT="/opt/dashcam"
DASHCAM_ROOT_LEGAL=$DASHCAM_ROOT"/legal"
echo "Install necessary packages (python-venv, pip)"
sudo apt install python3-venv python3-pip pigpio
for DCFile in dashcam.py led.py switch.py;
do
echo "Copy file "$DCFile" to "$DASHCAM_ROOT/$DCFile
sudo cp $DCFile $DASHCAM_ROOT/$DCFile
sudo chmod a+x $DASHCAM_ROOT/$DCFile
done
echo "Setting Python3 virtual env '.venv' at '"$DASHCAM_ROOT"/.venv'"
sudo python3 -m venv $DASHCAM_ROOT/.venv
sudo $DASHCAM_ROOT/.venv/bin/pip3 install --upgrade pip
sudo $DASHCAM_ROOT/.venv/bin/pip3 install picamera RPi.GPIO pigpio
echo "Setup systemd service at /etc/systemd/system/dashcam.service"
sudo cp dashcam.service.example /etc/systemd/system/dashcam.service
echo "Reload systemctl daemon service"
sudo systemctl daemon-reload
echo "Prepare dashcam service to start after reboot"
sudo systemctl enable dashcam.service pigpiod.service
echo "Start dashcam service"
sudo systemctl start pigpiod.service dashcam.service