123456789101112131415161718192021222324252627282930 |
- #!/bin/sh
- REPO_DIR=/opt/pyHeatpump
- LIB_DIR=/var/lib/pyheatpump
-
-
- # cd /opt/pyheatpump git clone https://git.yannweb.net/cli/pyHeatpump.git
- [ ! -d $REPO_DIR ] \
- && echo "Missing $REPO_DIR" \
- && exit 1;
-
- [ ! -d /var/lib/pyheatpump ] && mkdir --mode 0700 /var/lib/pyheatpump
- # If files already exist don't var/lib the script
- [ -f $LIB_DIR/pyheatpump.sqlite3 ] && [ -f $LIB_DIR/pyheatpump.ini ] \
- && exit 0;
-
- # Database initialization
- if [ ! -f $LIB_DIR/pyheatpump.sqlite3 ];
- then
- sqlite3 -init $REPO_DIR/db/pyheatpump.sql $LIB_DIR/pyheatpump.sqlite3 .quit \
- || (echo "Failed to initialize database" && exit 1);
- fi
-
- # Default configuration setup
- if [ ! -f $LIB_DIR/pyheatpump.ini ];
- then
- cp $REPO_DIR/config/pyheatpump.prod.ini.dist $LIB_DIR/pyheatpump.ini \
- || (echo "Failed to initialized configuration file" && exit 1);
- fi
-
- exit 0;
|