elgg-install.sh 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/sh
  2. set -e
  3. WAIT_MYSQL_START="30" # In seconds
  4. #wait for mysql
  5. i=0
  6. while ! netcat $ELGG_DB_HOST $ELGG_DB_PORT >/dev/null 2>&1 < /dev/null; do
  7. i=`expr $i + 1`
  8. if [ $i -ge $MYSQL_LOOPS ]; then
  9. echo "$(date) - ${ELGG_DB_HOST}:${ELGG_DB_PORT} still not reachable, giving up."
  10. exit 1
  11. fi
  12. echo "$(date) - waiting for ${ELGG_DB_HOST}:${ELGG_DB_PORT}... $i/$WAIT_MYSQL_START."
  13. sleep 1
  14. done
  15. echo "The MySQL server is ready."
  16. echo "Starting installation elgg."
  17. #This directory will hold Elgg's ``settings.php`` file after installation.
  18. if [ ! -d "${ELGG_PATH}elgg-config/" ]; then
  19. mkdir "${ELGG_PATH}elgg-config/"
  20. chown -R www-data:www-data "${ELGG_PATH}elgg-config/"
  21. fi
  22. # Dependencies install
  23. if [ ! -f "${ELGG_PATH}vendor/autoload.php" ]; then
  24. echo 'File vendor/autoload.php does not exist.'
  25. echo 'Running composer install'
  26. composer install --prefer-source
  27. fi
  28. if [ ! -d "$ELGG_DATA_ROOT" ]; then
  29. mkdir $ELGG_DATA_ROOT
  30. chmod -R 770 "${ELGG_DATA_ROOT}"
  31. chown -R www-data:www-data "${ELGG_DATA_ROOT}"
  32. fi
  33. php /elgg-docker/elgg-install.php