Add support for post-mysql-init scripts (closes #27)

This commit is contained in:
Christoph Wiechert 2019-10-10 12:46:07 +02:00
parent c1e428a3ed
commit 27d1b7469b

View File

@ -43,6 +43,14 @@ if $MYSQL_AUTOCONF ; then
if [ "$(echo "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = \"$MYSQL_DB\";" | $MYSQLCMD)" -le 1 ]; then
echo Initializing Database
cat /etc/pdns/schema.sql | $MYSQLCMD
# Run custom mysql post-init sql scripts
if [ -d "/etc/pdns/mysql-postinit" ]; then
for SQLFILE in $(ls -1 /etc/pdns/mysql-postinit/*.sql | sort) ; do
echo Source $SQLFILE
cat $SQLFILE | $MYSQLCMD
done
fi
fi
unset -v MYSQL_PASS