]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Improving starting.sh
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Wed, 18 Jun 2025 12:50:38 +0000 (08:50 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Wed, 18 Jun 2025 12:50:38 +0000 (08:50 -0400)
conf/mailleur.conf
mailleur.spec.in
support/starting.sh

index 24073d14c8a64d52c9f78c551fe2999ac3bea65f..469093422a6aab57574df00bdd46664564e32b69 100644 (file)
@@ -30,9 +30,8 @@ CA_KEY_CLT    =       "./certs/localhost-key.pem"
 CA_VERIFY_CLT  =       0       #to check PEER/server remote certificate
 #------------------------------------------------
 #Configured for Postgresql database
-#DB_TYPE can be either POSTGRES,MYSQL, default POSTGRES
-#DB_TYPE       =       MYSQL
-DB_TYPE                =       POSTGRES
+#DB_TYPE can be either POSTGRES,MYSQL
+DB_TYPE                =       DB_TO_BE_DEFINED
 DB_NAME                =       mailleur
 DB_HOST                =       localhost
 DB_PORT                =       5432
index 74d3d257df0dcd8fcf8249449da8fcf511fdd400..9f33178727f28ff1f687e8c29fbe25991782bebd 100644 (file)
@@ -145,6 +145,13 @@ Obsoletes  :       %{name}-mysql           <= %{version}-%{release}
 %files                 postgresql
 %defattr(-,root,root,-)
 
+%post
+if [ "$1" = 1 ]; then
+  sed -i                                       \
+       -e "s/DB_TO_BE_DEFINED/POSTGRES/"       \
+       %{_sysconfdir}/%{name}/%{name}.conf
+  fi
+
 #=============================================================================
 %package               mysql
 Summary                :       mailleur using mysql/mariadb as Data-base
@@ -163,6 +170,12 @@ Obsoletes  :       %{name}-postgresql      <= %{version}-%{release}
 %files                 mysql
 %defattr(-,root,root,-)
 
+%post
+if [ "$1" = 1 ]; then
+  sed -i                                       \
+       -e "s/DB_TO_BE_DEFINED/MYSQL/"          \
+       %{_sysconfdir}/%{name}/%{name}.conf
+  fi
 #=============================================================================
 %prep
 %setup -q
index adbdaf1bf88a2d08e096acdb43450278178d2c07..2db71a61c2f0069d03bd7b54a964946363fbb253 100644 (file)
@@ -1,5 +1,29 @@
 #! /usr/bin/bash
 #---------------------------------------------------------------
-#empty scrript for now
+#program to check everything is ready to start clement
+#$1 is either "sysvinit", "systemd" or "osukiss
+#===============================================================
+OS=$1           #set the OS Type
+#Hard coded variables
+APPNAME=mailleur
+#===============================================================
+#procedure to check if the config is properly done
+#you MUST AT LEAST, specify the Data Base type to be used by clement.
+#----------------------------------------------------------------------
+chk_config()
+
+{
+if      [ -z "$DB_TYPE" -o "$DB_TYPE" = "DB_TO_BE_DEFINED" ] ; then
+  echo -n "Checking file /etc/$APPNAME/$APPNAME.conf"
+  sh_failure $1 $" ->> not configured"
+  echo -e "\tPlease set DB_TYPE within /etc/$APPNAME/$APPNAME.conf"
+  echo -e "\tAborting start, Exiting at once"
+  exit -1;
+  fi
+}
+
+#===============================================================
+#main script
+chk_config $1;
+exit 0;
 #---------------------------------------------------------------
-exit 0