-
Notifications
You must be signed in to change notification settings - Fork 5
/
install
executable file
·50 lines (37 loc) · 1.16 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
44
45
46
47
48
49
50
#!/bin/sh
### set git cloned location
GIT_PATH=~/emonhub
### set location to install emonhub.py etc
INST_PATH=/usr/share/emonhub
### clone emonhub
git clone https://github.com/emonhub/emonhub.git $GIT_PATH
### switch to development branch
cd $GIT_PATH
git checkout development
cd $OLDPWD
### 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 /etc/emonhub/emonhub.conf ] ; then
{
sudo mkdir -p /etc/emonhub
sudo mv $GIT_PATH/conf/emonhub.conf /etc/emonhub/emonhub.conf
}
fi
# launch at start-ip
sudo update-rc.d emonhub defaults 99
###install dependancies
sudo apt-get install -y python-serial python-configobj
### create "emonhub" user
sudo useradd -M -r -G dialout,tty -c "emonHub user" emonhub
### start emonhub
sudo service emonhub restart
### delete install script
sudo rm -r ~/dev-emonhub