forked from openenergymonitor/emonhub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·43 lines (31 loc) · 1.02 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
#!/bin/sh
echo "Emonhub installation script for emonPi"
### set git cloned location
GIT_PATH=/home/pi/emonhub
if [ ! -d /home/pi ] ; then
{
echo "Directory /home/pi does not exist, this installation script is for raspberrypi installation"
exit
}
fi
### set location to install emonhub.py etc
INST_PATH=/usr/share/emonhub
### create linked directory for emonhub.py etc
sudo rm -r -f $INST_PATH
sudo ln -s $GIT_PATH/src $INST_PATH
### link init script
sudo rm -f /etc/init.d/emonhub
sudo ln -s $GIT_PATH/service/emonhub /etc/init.d/emonhub
### link default locations file
sudo rm -f /etc/default/emonhub
sudo ln -s $GIT_PATH/conf/default/emonhub /etc/default/emonhub
### create folder and move settings file (unless it exists already)
if [ ! -f /home/pi/data/emonhub.conf ] ; then
{
sudo mv $GIT_PATH/conf/emonpi.default.emonhub.conf /home/pi/data/emonhub.conf
}
fi
# launch at start-ip
sudo update-rc.d emonhub defaults 99
### create "emonhub" user
sudo useradd -M -r -G dialout,tty -c "emonHub user" emonhub