2020-05-05 02:23:55 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2020-05-06 17:03:48 +01:00
|
|
|
case "${DBMS}" in
|
|
|
|
'postgres')
|
2022-03-19 15:49:04 +00:00
|
|
|
test "$(PGPASSWORD="${POSTGRES_PASSWORD}" psql -Upostgres -hdb -tAc "select 1 from pg_database where datname='${SOCIAL_DB}'")" = "1"
|
2020-05-06 17:03:48 +01:00
|
|
|
DB_EXISTS=$?
|
|
|
|
;;
|
|
|
|
'mariadb')
|
2020-05-16 13:37:06 +01:00
|
|
|
mysqlcheck -cqs -uroot -p"${MYSQL_ROOT_PASSWORD}" -hdb social 2> /dev/null
|
2020-05-06 17:03:48 +01:00
|
|
|
DB_EXISTS=$?
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unknown DBMS"
|
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
|
2020-05-16 13:37:06 +01:00
|
|
|
if [ ${DB_EXISTS} -ne 0 ]; then
|
2020-05-05 02:23:55 +01:00
|
|
|
|
2020-05-16 13:37:06 +01:00
|
|
|
echo "Installing GNU social"
|
|
|
|
echo "Installing composer dependencies"
|
2020-05-05 02:23:55 +01:00
|
|
|
|
2020-05-16 13:37:06 +01:00
|
|
|
cd /var/www/social || exit 1
|
2020-05-05 02:23:55 +01:00
|
|
|
|
2021-04-11 20:57:04 +01:00
|
|
|
composer -n install
|
2020-05-05 02:23:55 +01:00
|
|
|
|
2020-05-06 16:32:07 +01:00
|
|
|
chmod g+w -R .
|
|
|
|
chown -R :www-data .
|
2020-05-05 02:23:55 +01:00
|
|
|
|
2022-03-19 15:49:04 +00:00
|
|
|
php bin/console doctrine:database:drop -f
|
|
|
|
php bin/console doctrine:database:create
|
2021-11-02 10:40:01 +00:00
|
|
|
php bin/console doctrine:schema:create || exit 1
|
|
|
|
php bin/console app:populate_initial_values || exit 1
|
2020-05-05 02:23:55 +01:00
|
|
|
|
2022-02-26 12:18:40 +00:00
|
|
|
./bin/install_plugins.sh
|
|
|
|
|
2020-05-05 02:23:55 +01:00
|
|
|
echo "GNU social is installed"
|
2020-05-16 13:37:06 +01:00
|
|
|
else
|
|
|
|
echo "GNU social is already installed"
|
2020-05-05 02:23:55 +01:00
|
|
|
fi
|