-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup
executable file
·31 lines (27 loc) · 1004 Bytes
/
setup
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
#!/bin/bash -e
# Install python, pip and virtualenv
sudo apt-get install python3-pip
sudo apt-get install python3
sudo apt-get install python3-gpiozero
sudo apt-get install nginx -y
sudo apt-get install fswebcam -y
sudo pip install virtualenv -y
# Set the base path to the current directory
BASEDIR=`dirname $0`
# Setup the virtual environment if it doesn't exist
if [ ! -d "$BASEDIR/ve" ]; then
virtualenv -q --python=/usr/bin/python3.4 $BASEDIR/env --no-site-packages
echo "Virtualenv created."
fi
# Create the requirements.txt if it doesn't exist
if [ ! -f "$BASEDIR/requirements.txt" ]; then
touch requirements.txt
fi
# Install the requirements file if the updated file doesn't exist or the requirements file
# has a newer timestamp than the updated file
if [ ! -f "$BASEDIR/ve/updated" -o $BASEDIR/requirements.txt -nt $BASEDIR/ve/updated ]; then
. env/bin/activate
pip install -r $BASEDIR/requirements.txt
touch $BASEDIR/env/updated
echo "Requirements installed."
fi