2020-05-05 10:23:55 +09:00
|
|
|
#!/bin/sh
|
|
|
|
|
2020-05-07 01:03:48 +09:00
|
|
|
case "${DBMS}" in
|
|
|
|
'postgres')
|
|
|
|
PGPASSWORD="${POSTGRES_PASSWORD}" psql -ltq -Upostgres -hdb | \
|
|
|
|
cut -d '|' -f1 | grep -wq "${SOCIAL_DB}"
|
|
|
|
DB_EXISTS=$?
|
|
|
|
;;
|
|
|
|
'mariadb')
|
|
|
|
mysqlcheck -cqs -uroot -p${MYSQL_ROOT_PASSWORD} -hdb social 2> /dev/null
|
|
|
|
DB_EXISTS=$?
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unknown DBMS"
|
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
|
|
|
|
if [ ! ${DB_EXISTS} ]; then
|
2020-05-05 10:23:55 +09:00
|
|
|
|
|
|
|
echo -e "Installing GNU social\nInstalling composer dependencies"
|
|
|
|
|
|
|
|
cd /var/www/social
|
|
|
|
|
|
|
|
composer install
|
|
|
|
|
2020-05-07 00:32:07 +09:00
|
|
|
chmod g+w -R .
|
|
|
|
chown -R :www-data .
|
2020-05-05 10:23:55 +09:00
|
|
|
|
2020-05-07 00:32:07 +09:00
|
|
|
php bin/console doctrine:database:create || exit 1
|
2020-05-05 10:23:55 +09:00
|
|
|
|
|
|
|
echo "GNU social is installed"
|
|
|
|
fi
|