From 7854a361e75a4e4cb3e744f29891081f641f4181 Mon Sep 17 00:00:00 2001 From: "Jean-Marc Pigeon (Delson)" Date: Mon, 23 Jun 2025 13:42:12 -0400 Subject: [PATCH] Starting to implement the mariadb rpm --- conf/mailleur.conf | 2 +- support/crdb.sh | 23 +++++++++++++++++++++-- support/starting.sh | 5 ++--- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/conf/mailleur.conf b/conf/mailleur.conf index d11aa2a..c2f654e 100644 --- a/conf/mailleur.conf +++ b/conf/mailleur.conf @@ -34,7 +34,7 @@ CA_VERIFY_CLT=0 #to check PEER/server remote certificate #------------------------------------------------ #Configured for Postgresql database #DB_TYPE can be either POSTGRESQL,MYSQL, default POSTGRESQL -DB_TYPE=POSTGRESQL +DB_TYPE=TO_BE_DEFINED DB_NAME=mailleur DB_HOST=localhost DB_PORT=5432 diff --git a/support/crdb.sh b/support/crdb.sh index 66388ac..05a92f3 100755 --- a/support/crdb.sh +++ b/support/crdb.sh @@ -24,9 +24,28 @@ LOG=/etc/$APPNAME/dbinst.log USER=`id -nu` #building data_base case "$DB_TYPE" in - "MYSQL" ) + "TO_BE_DEFINED" ) + echo "Data base type is NOT set within mailleur.conf" + exit 1 ;; - "POSTGRESQL" ) + "MYSQL" ) + SQL="mysqld" + /etc/rc.d/init.d/mysql stop + #grabbing temporary control on the MySQL daemo + /usr/bin/mysqld_safe -u root --skip-grant-tables >> $LOG 2>&1 + sleep 5 #give time to daemon to start + ( + echo "CREATE TABLE user_bck AS (SELECT * FROM user);" + echo "UPDATE user SET Password=NULL WHERE User='root' AND Host='localhost';" + ) | mysql -u root mysql >> $LOG + ( + echo "Shutdown mysqld skip-grant-tables mode" + /usr/bin/mysqladmin -u root shutdown + echo "starting mysqld daemon" + /etc/rc.d/init.d/mysqld start + )>> + ;; + "POSTGRESQL" ) SQL="psql -q" /etc/rc.d/init.d/postgresql status if [ $? != 0 ] ; then diff --git a/support/starting.sh b/support/starting.sh index d23b558..b358fbc 100755 --- a/support/starting.sh +++ b/support/starting.sh @@ -114,10 +114,9 @@ do_mkdb() { case "$DB_TYPE" in - "MYSQL" ) - ;; + "MYSQL" | \ "POSTGRESQL" ) - /usr/lib/$APPNAME/support/crdb.sh "/" + /usr/lib/$APPNAME/support/crdb.sh if [ $? != 0 ] ; then exit -1 fi -- 2.47.3