forked from zanac/pyHPSU
-
Notifications
You must be signed in to change notification settings - Fork 15
/
install.sh
executable file
·59 lines (48 loc) · 1.24 KB
/
install.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
SHARE_DIR="/usr/share/pyHPSU/"
CONF_DIR="/etc/pyHPSU"
BIN_DIR="/usr/bin/"
PACKAGE_DIR="/usr/share/doc/packages/pyHPSU"
DIST_DIR="/usr/lib/python3/dist-packages/HPSU"
SERVICE_DIR="/etc/systemd/system/"
echo "Installing pyHPSU"
if [ ! -d $CONF_DIR ]; then
echo "Creating directory for config files"
mkdir -p $CONF_DIR
fi
if [ ! -d $PACKAGE_DIR ]; then
echo "Creating directory for shared files"
mkdir -p $PACKAGE_DIR
fi
if [ ! -d $BIN_DIR ]; then
echo "Creating directory for executable files"
mkdir -p $BIN_DIR
fi
if [ ! -d $DIST_DIR ]; then
echo "Creating directory for python includes files"
mkdir -p $DIST_DIR
fi
if [ ! -d $SHARE_DIR ]; then
echo "Creating directory for resource files"
mkdir -p $SHARE_DIR
fi
# copy configs
cp etc/pyHPSU/commands* $CONF_DIR/
if [ -f /etc/pyHPSU/pyhpsu.conf ]; then
cp etc/pyHPSU/pyhpsu.conf $CONF_DIR/pyhpsu.conf.new
else
cp etc/pyHPSU/pyhpsu.conf $CONF_DIR/
fi
# copy the rest
cp -r resources/* $SHARE_DIR
cp -r HPSU/* $DIST_DIR
cp -r contrib $DIST_DIR
# copy service file
cp systemd/* $SERVICE_DIR
systemctl --system daemon-reload
# copy binarys
cp pyHPSU.py $BIN_DIR
cp pyHPSUd.py $BIN_DIR
chmod a+x $BIN_DIR/pyHPSU.py
chmod a+x $BIN_DIR/pyHPSUd.py
echo "Installation done!!!"