From 27d1b7469b091da75d886a81eb74c7b9810acb1d Mon Sep 17 00:00:00 2001 From: Christoph Wiechert Date: Thu, 10 Oct 2019 12:46:07 +0200 Subject: [PATCH] Add support for post-mysql-init scripts (closes #27) --- entrypoint.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index f4fe6e4..40f5184 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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