-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall
executable file
·53 lines (43 loc) · 1.42 KB
/
install
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
#!/bin/bash
GREEN='\033[1;32m'
RED='\033[1;31m'
BLUE='\033[1m\033[34m'
NOCOLOR='\033[0m'
# Check if sudo is used
if [ "$(id -u)" != 0 ]; then
echo -e "${RED}Installation script must be run with root permissions${NOCOLOR}"
exit 1
fi
# Install apt apps from pkglist
echo -e "${BLUE}==> Installing apt packages${NOCOLOR}"
sudo apt -y update
sudo apt -y upgrade
sudo apt -y install `cat setup/pkglist`
echo -e "${GREEN}Apt packages installation done${NOCOLOR}"
# Install pip modules from requirements.txt
echo -e "${BLUE}==> Installing python modules${NOCOLOR}"
pip3 install -r setup/requirements.txt
echo -e "${GREEN}Python modules installation done${NOCOLOR}"
# Load setup functions
. ./setup/setup_rpi_hw.sh
. ./setup/setup_rpi_sw.sh
# Enable i2c bus on Rpi
echo -e "${BLUE}==> Setting up hardware buses${NOCOLOR}"
setup_i2c
setup_one_wire
setup_hum_sensor
setup_rtc
setup_camera
echo -e "${GREEN}Hardware setup done${NOCOLOR}"
echo -e "${BLUE}==> Setting up web server and database${NOCOLOR}"
mysql --user=root < setup/db_setup.sql
setup_webserver
echo -e "${GREEN}Database setup done${NOCOLOR}"
# Create directories
echo -e "${BLUE}==> Setting up required directories${NOCOLOR}"
[ ! -d /var/log/pi_observer ] && mkdir /var/log/pi_observer
echo -e "${GREEN}Setup done${NOCOLOR}"
# Install system scripts
install ./scripts/* /usr/local/bin
read -p "Do you wish to reboot now? [Y/n]" -n 1 -s ans && echo
[ "${ans}" != "n" ] && reboot