install.sh 816 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. echo "GNU social is installed"
  27. else
  28. echo "GNU social is already installed"
  29. fi