-
Notifications
You must be signed in to change notification settings - Fork 2
/
install-camera.timelapse.sh
65 lines (55 loc) · 2.4 KB
/
install-camera.timelapse.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
# This script will install the camera and any required prerequisites.
cd ~
echo -e ''
echo -e '\033[32mCamera Timelapse [Installation Script] \033[0m'
echo -e '\033[32m-------------------------------------------------------------------------- \033[0m'
echo -e ''
echo -e '\033[93mUpdating package repositories... \033[0m'
sudo apt update
echo ''
echo -e '\033[93mInstalling prerequisites... \033[0m'
sudo apt install -y git python3 python3-pip python3-picamera2 ffmpeg libopenblas-dev
sudo pip3 install piexif ffmpeg-python google-api-python-client google-auth-httplib2 google-auth-oauthlib oauth2client moviepy --force --break-system-packages
echo ''
echo -e '\033[93mProvisioning logs... \033[0m'
sudo mkdir -p /home/pi/logs
sudo chmod +rw /home/pi/logs
sudo sed -i '\|^tmpfs /home/pi/logs|d' /etc/fstab
sudo sed -i '$ a tmpfs /home/pi/logs tmpfs defaults,noatime,nosuid,size=16m 0 0' /etc/fstab
sudo mount -a
echo ''
echo -e '\033[93mInstalling Camera... \033[0m'
cd ~
sudo mv ~/camera.timelapse/config.json ~/camera.timelapse-config.json.bak 2> /dev/null || true
sudo rm -Rf ~/camera.timelapse
sudo git clone https://github.com/eat-sleep-code/camera.timelapse
sudo chown -R $USER:$USER camera.timelapse
cd camera.timelapse
sudo chmod +x camera.timelapse.py
sudo chmod +x camera.timelapse.upload.py
sudo chmod +x echo-server.py
sudo mkdir -p ~/dcim
sudo chown -R $USER:$USER ~/dcim
sudo chown -R $USER:$USER ~/logs
echo ''
echo -e '\033[93mCreating Service... \033[0m'
sudo mv camera.timelapse.service /etc/systemd/system/camera.timelapse.service
sudo chown root:root /etc/systemd/system/camera.timelapse.service
sudo chmod +x *.sh
echo 'Please see the README file for more information on configuring the service.'
cd ~
echo ''
echo -e '\033[93mSetting up aliases... \033[0m'
sudo touch ~/.bash_aliases
sudo sed -i '/\b\(function camera.timelapse\)\b/d' ~/.bash_aliases
sudo sed -i '$ a function camera.timelapse { sudo python3 ~/camera.timelapse/camera.timelapse.py "$@"; }' ~/.bash_aliases
echo -e 'You may use \e[1mcamera.timelapse <options>\e[0m to launch the program.'
echo ''
echo 'To use the automatic YouTube upload feature, you will need to update the config.json.'
echo 'Please see the README file for more information.'
echo ''
echo -e '\033[32m-------------------------------------------------------------------------- \033[0m'
echo -e '\033[32mInstallation completed. \033[0m'
echo ''
sudo rm ~/install-camera.timelapse.sh
bash