]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Improving spec file about resetdb.sh
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Thu, 26 Jun 2025 01:09:46 +0000 (21:09 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Thu, 26 Jun 2025 01:09:46 +0000 (21:09 -0400)
mailleur.spec.in
support/resetdb.sh

index b671b13d3f602becf10ca7196d9e7576aad0e4d5..9d81f44aaa90f221b4ff80afd1c0eaf48f8c2c88 100644 (file)
@@ -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
index edd88c7a448fb6edb674f54139a276fcdd649d73..742c839a0273c5eb8ea724f688bf1482f3daf018 100755 (executable)
@@ -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!