From 91cbdc23de3e93079284881710c041aa92a798b4 Mon Sep 17 00:00:00 2001 From: "Jean-Marc Pigeon (Delson)" Date: Wed, 25 Jun 2025 21:09:46 -0400 Subject: [PATCH] Improving spec file about resetdb.sh --- mailleur.spec.in | 1 + support/resetdb.sh | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mailleur.spec.in b/mailleur.spec.in index b671b13..9d81f44 100644 --- a/mailleur.spec.in +++ b/mailleur.spec.in @@ -48,6 +48,7 @@ search about email exchange within time and transaction context. %attr(0754,root,root) %{_libdir}/%{name}/support/crdb.sh %attr(0754,root,root) %{_libdir}/%{name}/support/dummy-cert.sh %attr(0754,root,root) %{_libdir}/%{name}/support/starting.sh +%attr(0750,%{name},mail) %{_libdir}/%{name}/support/resetdb.sh %attr(0755,%{name},mail) %dir %{spooldir}/%{name}/{in-logs,mails,queue,out-logs} %attr(0640,root,root) %{_datadir}/%{name}/sql/Makefile %attr(0644,root,root) %{_datadir}/%{name}/sql/datatest.def diff --git a/support/resetdb.sh b/support/resetdb.sh index edd88c7..742c839 100755 --- a/support/resetdb.sh +++ b/support/resetdb.sh @@ -35,8 +35,12 @@ case "$DB_TYPE" in SQL="psql -q $APPNAME" ;; "MYSQL" ) - echo "Got Mysql" - exit 1 + DB=$(mariadb-show | grep $APPNAME ) + if [ ! -z "$DB" ] ; then + echo "DROP DATABASE mailleur;" | mariadb + fi + echo "create database $APPNAME;" | mariadb + SQL="mariadb -q $APPNAME" ;; * ) echo $DB_TYPE is not expected!, check configuration file! -- 2.47.3