install.sh 880 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/sh
  2. case "${DBMS}" in
  3. 'postgres')
  4. PGPASSWORD="${POSTGRES_PASSWORD}" psql -ltq -Upostgres -hdb | \
  5. cut -d '|' -f1 | grep -Fwq "${SOCIAL_DB}"
  6. DB_EXISTS=$?
  7. ;;
  8. 'mariadb')
  9. mysqlcheck -cqs -uroot -p"${MYSQL_ROOT_PASSWORD}" -hdb social 2> /dev/null
  10. DB_EXISTS=$?
  11. exit 1
  12. ;;
  13. *)
  14. echo "Unknown DBMS"
  15. exit 1
  16. esac
  17. if [ ${DB_EXISTS} -ne 0 ]; then
  18. echo "Installing GNU social"
  19. echo "Installing composer dependencies"
  20. cd /var/www/social || exit 1
  21. composer -n install
  22. chmod g+w -R .
  23. chown -R :www-data .
  24. php bin/console doctrine:database:create || exit 1
  25. php bin/console doctrine:schema:create || exit 1
  26. php bin/console app:populate_initial_values || exit 1
  27. echo "GNU social is installed"
  28. else
  29. echo "GNU social is already installed"
  30. fi