-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·26 lines (22 loc) · 811 Bytes
/
Copy pathinstall.sh
File metadata and controls
executable file
·26 lines (22 loc) · 811 Bytes
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
#Install stuff through apt
echo "Install python3-smbus and python3-pip via apt"
sudo apt install python3-smbus python3-pip
#Install stuff through pip
echo "Install paho-mqtt and pyyaml through pip"
sudo pip3 install paho-mqtt pyyaml
#Copy script to /usr/local/bin
echo "Copy python code into /usr/local/bin/"
sudo cp -v *.py /usr/local/bin/
sudo chmod 774 /usr/local/bin/waveshare_ups.py
#Copy yaml but don't overwrite
CONFIG=waveshare_ups.yaml
echo "Copy config to $CONFIG if it doesn't exist already"
sudo cp -v -n $CONFIG /etc/$CONFIG
sudo chmod 664 $CONFIG
#Copy systemd script, run daemon-reload
echo "Copy service file"
SERVICE=waveshare_ups.service
sudo cp -v $SERVICE /etc/systemd/system/$SERVICE
sudo chmod 664 /etc/systemd/system/$SERVICE
echo "Reload systemd daemons"
sudo systemctl daemon-reload