|
@@ -1,10 +1,12 @@
|
1
|
1
|
#!/bin/sh
|
2
|
2
|
|
3
|
3
|
# If directory exists don't run the script
|
4
|
|
-[ ! -d /run/pyheatpump ] && mkdir /run/pyheatpump || exit 0;
|
5
|
|
-
|
6
|
4
|
# cd /opt/pyheatpump git clone https://git.yannweb.net/cli/pyHeatpump.git
|
7
|
|
-[ ! -d /opt/pyHeatpump/ ] && echo "Missing /opt/pyheatpump/" && exit 1;
|
|
5
|
+[ ! -d /opt/pyHeatpump/ ] && echo "Missing /opt/pyHeatpump/" && exit 1;
|
|
6
|
+[ ! -d /run/pyheatpump/ ] && echo "Missing /run/pyheatpump/" && exit 1;
|
|
7
|
+
|
|
8
|
+[ -f /run/pyheatpump/pyheatpump.sqlite3 ] && [ -f /run/pyheatpump/pyheatpump.ini ] \
|
|
9
|
+ && echo "Incorrect runtime directory" && exit 1;
|
8
|
10
|
|
9
|
11
|
# Database initialization
|
10
|
12
|
sqlite3 -init /opt/pyHeatpump/db/pyheatpump.sql /run/pyheatpump/pyheatpump.sqlite3 .quit \
|
|
@@ -13,3 +15,5 @@ sqlite3 -init /opt/pyHeatpump/db/pyheatpump.sql /run/pyheatpump/pyheatpump.sqlit
|
13
|
15
|
# Default configuration setup
|
14
|
16
|
cp /opt/pyHeatpump/config/pyheatpump.prod.ini.dist /run/pyheatpump/pyheatpump.ini \
|
15
|
17
|
|| (echo "Failed to initialized configuration file" && exit 1);
|
|
18
|
+
|
|
19
|
+exit 0;
|