[TOOLS] Updated install script to also support mariadb

This commit is contained in:
Hugo Sales 2020-05-06 16:03:48 +00:00 committed by Hugo Sales
parent 50e450f082
commit 8a86c5940d
Signed by untrusted user: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
2 changed files with 19 additions and 8 deletions

View File

@ -1,12 +1,12 @@
#!/bin/sh
case $DBMS in
"mariadb")
CMD="mysqladmin ping --silent -hdb -uroot -p${MYSQL_ROOT_PASSWORD}"
;;
"postgres")
CMD="pg_isready -hdb -q -Upostgres"
;;
"mariadb")
CMD="mysqladmin ping --silent -hdb -uroot -p${MYSQL_ROOT_PASSWORD}"
;;
*)
exit 1
esac

View File

@ -1,11 +1,22 @@
#!/bin/sh
PGPASSWORD="${POSTGRES_PASSWORD}" psql -ltq -Upostgres -hdb | \
cut -d '|' -f1 | grep -wq "${SOCIAL_DB}"
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 [ ! $? ]; then
echo ${SOCIAL_DB}
if [ ! ${DB_EXISTS} ]; then
echo -e "Installing GNU social\nInstalling composer dependencies"