Projet de remplacement du "RPiPasserelle" d'Otec.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pre-exec.sh 849B

123456789101112131415161718192021222324252627282930
  1. #!/bin/sh
  2. REPO_DIR=/opt/pyHeatpump
  3. LIB_DIR=/var/lib/pyheatpump
  4. # cd /opt/pyheatpump git clone https://git.yannweb.net/cli/pyHeatpump.git
  5. [ ! -d $REPO_DIR ] \
  6. && echo "Missing $REPO_DIR" \
  7. && exit 1;
  8. [ ! -d /var/lib/pyheatpump ] && mkdir --mode 0700 /var/lib/pyheatpump
  9. # If files already exist don't var/lib the script
  10. [ -f $LIB_DIR/pyheatpump.sqlite3 ] && [ -f $LIB_DIR/pyheatpump.ini ] \
  11. && exit 0;
  12. # Database initialization
  13. if [ ! -f $LIB_DIR/pyheatpump.sqlite3 ];
  14. then
  15. sqlite3 -init $REPO_DIR/db/pyheatpump.sql $LIB_DIR/pyheatpump.sqlite3 .quit \
  16. || (echo "Failed to initialize database" && exit 1);
  17. fi
  18. # Default configuration setup
  19. if [ ! -f $LIB_DIR/pyheatpump.ini ];
  20. then
  21. cp $REPO_DIR/config/pyheatpump.prod.ini.dist $LIB_DIR/pyheatpump.ini \
  22. || (echo "Failed to initialized configuration file" && exit 1);
  23. fi
  24. exit 0;