install.sh 1.72 KB
#!/bin/sh

#D00rPi - Welcome the user
Say "Welcome to DoorPi Installer!"

# Update and Upgrade the Distro
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
sudo raspi-config

# Download and Install all the needed files from apt-get
LIST_OF_APPS="build-essential python3 python3-pip python3-picamera python3-gpiozero python3-venv curl git-core libssl-dev libcurl4-openssl-dev libjpeg-dev libx264-142 libavcodec56 libavformat56 libmysqlclient18 libswscale3 libpq5 libjpeg62 apache2 apache2-utils libapache2-mod-php5 php5 php-pear php5-xcache php5-mysql php5-curl php5-gd mysql-client php5-mcrypt motion" # Package name separated by a space

# Update and install the required packages
apt-get install -y $LIST_OF_APPS

# Setup git-core
sudo git config --global user.name "DoorPi"
sudo git config --global user.email mathew@mathewjenkinson.com

# Copy the motion config file(s) from here to the motion source
sudo cp -r modules /etc/modules
sudo cp -r motion.conf /etc/motion/motion.conf
sudo cp -r motion /etc/default/motion

# Install DoorPi into /etc/
sudo mkdir /etc/doorpi
sudo cp cp -r DoorPiMedia.py /etc/doorpi/DoorPiMedia.py
sudo cp cp -r config.json /etc/doorpi/config.json

# Make the DoorPi script Executable
sudo chmod +x /etc/doorpi/DoorPiMedia.py

# Install using python3-pip the needed modules
sudo pip3 install boto twilio

# Check the Device can connect to ClusterPi MySQL Server
if ! mysql --host=192.168.1.85 --user=security --password=s3cur1ty 85batteryplace; then
  say "Could not connect to House SQL Server"
fi

# Reboot the server to force all new changes
say "All installs have been completed, Please reboot this Pi."
#sudo shutdown now -r

# The command to boot motion is: sudo motion -c /etc/motion/motion.conf