From b6105cce41cb5d9eb9e8f06187a897f6c845ea07 Mon Sep 17 00:00:00 2001 From: Jean-Marc Pigeon Date: Fri, 14 Nov 2025 06:01:27 -0500 Subject: [PATCH] Starting to implement preset.sql data base --- Makefile.dist | 1 + mailleur.spec.in | 1 + sql/preset.sql | 16 ++++++++++++++++ support/do_database.sh | 4 +++- 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 sql/preset.sql diff --git a/Makefile.dist b/Makefile.dist index b362035..767b79a 100644 --- a/Makefile.dist +++ b/Makefile.dist @@ -70,6 +70,7 @@ tarfile : clean $(APLV)/sysconfig @ cp -a \ sql/$(APPN).sql \ + sql/preset.sql \ sql/datatest.* \ sql/Makefile \ $(APLV)/sql diff --git a/mailleur.spec.in b/mailleur.spec.in index 051638f..5053257 100644 --- a/mailleur.spec.in +++ b/mailleur.spec.in @@ -90,6 +90,7 @@ search about email exchange within time and transaction context. %attr(0640,%{name},apache) %{wwwdir}/%{name}/reg-icons/*.gif %attr(0640,%{name},apache) %{wwwdir}/%{name}/reg-icons/*.png %attr(0644,root,root) %{_datadir}/%{name}/sql/%{name}.sql +%attr(0644,root,root) %{_datadir}/%{name}/sql/preset.sql %exclude %{_datadir}/%{name}/sql/%{name}.mysql %exclude %{_datadir}/%{name}/sql/%{name}.postg #----------------------------------------------------------------------------- diff --git a/sql/preset.sql b/sql/preset.sql new file mode 100644 index 0000000..4a95c22 --- /dev/null +++ b/sql/preset.sql @@ -0,0 +1,16 @@ + +/********************************************************/ +/* */ +/* This file define the mailleur data base */ +/* local preset value */ +/* */ +/********************************************************/ + + +/********************************************************/ +/* */ +/* Creating the bare minimun user configuration */ +/* */ +/********************************************************/ +INSERT INTO admins (email) + VALUES ('root@$DOMAINNAME'); diff --git a/support/do_database.sh b/support/do_database.sh index aa12372..9d0daa1 100755 --- a/support/do_database.sh +++ b/support/do_database.sh @@ -22,6 +22,7 @@ if [ -z "$DB_NAME" ] ; then #moving to the right directory cd $1 LOG=/etc/$APPNAME/dbinst.log +SQLLOG=/etc/$APPNAME/dbinfo.log USER=`id -nu` #building data_base ( @@ -97,5 +98,6 @@ case "$DB_TYPE" in esac #loading database definition if [ -n "$MSQL" ] ; then - cpp -P -D$DB_TYPE /usr/share/$APPNAME/sql/$APPNAME.sql | $MSQL + cpp -P -D$DB_TYPE /usr/share/$APPNAME/sql/$APPNAME.sql| tee -a $SQLLOG | $MSQL + cpp -P -D$DB_TYPE /usr/share/$APPNAME/sql/preset.sql | tee -a $SQLLOG | $MSQL fi -- 2.47.3