From: Jean-Marc Pigeon (Delson) Date: Thu, 26 Jun 2025 01:09:46 +0000 (-0400) Subject: Improving spec file about resetdb.sh X-Git-Tag: tag-0.10~28 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=91cbdc23de3e93079284881710c041aa92a798b4;p=jmp%2Fmailleur Improving spec file about resetdb.sh --- 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!