install.sh 964 B

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