-
Notifications
You must be signed in to change notification settings - Fork 4
/
pi_setup.sh
executable file
·33 lines (27 loc) · 1.52 KB
/
pi_setup.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
#!/bin/bash
sudo apt update
sudo apt install -y libatlas-base-dev python3-venv
python3 -m venv .venv
source .venv/bin/activate
pipenv install
echo "******************************************************************************"
echo "* Make sure to create a settings.py {use settings.py.template as a template} *"
echo "******************************************************************************"
read -p "Do You want to install this as a system service? (y/n)" -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
sudo cp dmm-ble-mp730026.service /etc/systemd/system/dmm-ble-mp730026.service
sudo sed "s|WorkingDirectory.*|WorkingDirectory=$PWD|" -i /etc/systemd/system/dmm-ble-mp730026.service
sudo sed "s|ExecStart.*|ExecStart=$PWD/.venv/bin/python3 main.py|" -i /etc/systemd/system/dmm-ble-mp730026.service
sudo systemctl enable dmm-ble-mp730026.service
sudo systemctl start dmm-ble-mp730026
echo "******************************************************************************"
echo "* Service installed and started *"
echo "* Check sudo journalctl -u dmm-ble-mp730026.service for errors *"
echo "******************************************************************************"
else
echo "******************************************************************************"
echo "* To start use: source ./run.sh *"
echo "******************************************************************************"
fi