]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Improving Spec file
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Mon, 16 Jun 2025 16:38:43 +0000 (12:38 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Mon, 16 Jun 2025 16:38:43 +0000 (12:38 -0400)
Makefile
Makefile.dist
conf/feeder.conf.dvl [deleted file]
conf/mailleur.conf
mailleur.spec.in

index b949a9cf47509f5e0c02c9a4d10fde67bb3af2f2..8f98f0b1ae836c2f6e94360d13e0ed66e000966f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -172,10 +172,14 @@ deltest   :
 #--------------------------------------------------------------------
 install        :
           @ # Creating all needed system directory
-          @ install -d $(DESTDIR)/$(SBINDIR)
+          @ install -d $(DESTDIR)/$(SBINDIR)/
+          @ install -d $(DESTDIR)/$(ETCDIR)/$(APPN)/
           @ cp -a                                      \
                bin/*                                   \
                $(DESTDIR)/$(SBINDIR)/
+          @ cp -a                                      \
+               conf/$(APPN).conf                       \
+               $(DESTDIR)/$(ETCDIR)/$(APPN)
 
 #--------------------------------------------------------------------
 SUBDIR =                                               \
@@ -188,6 +192,7 @@ APPNAME     =  mailleur
 #--------------------------------------------------------------------
 #Managing testarea
 SBINDIR = usr/sbin
+ETCDIR = etc
 CURDIR  = $(shell pwd)
 #--------------------------------------------------------------------
 .PHONY:   clean cleanrpm
index c448c78281c396eeeb9191ca4c8ed69fc0ae0c33..17d50e39b32b472a319aea6da58be8a5482c4e06 100644 (file)
@@ -28,12 +28,14 @@ tarfile     : clean
          @ echo "'$(APLV)' tar file, building"
          @ mkdir -p                                            \
                $(APLV)/app                                     \
+               $(APLV)/conf                                    \
                $(APLV)/bin                                     \
                $(APLV)/lib                                     \
                $(APLV)
          @ date > $(APLV)/$(APLV).build_date
          @ cp -a Makefile*     $(APLV)/
          @ cp -a app/*.c       $(APLV)/app/
+         @ cp -a conf/*.conf   $(APLV)/conf/
          @ cp -a lib/{*.c,*.h} $(APLV)/lib/
          @ cp -a app/Makefile  $(APLV)/app/Makefile
          @ cp -a lib/Makefile  $(APLV)/lib/Makefile
diff --git a/conf/feeder.conf.dvl b/conf/feeder.conf.dvl
deleted file mode 100644 (file)
index 97277eb..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#file used to set environement configuration
-#------------------------------------------------
-#Defining feeder Certificate
-CA_ROOT        =       "./certs/root-safe_CA.pem"
-CA_CERT        =       "./certs/localhost-chain-cert.pem"
-CA_KEY =       "./certs/localhost-key.pem"
-#------------------------------------------------
index b26d459f836848502507384ea85fcf02f6dc23a5..dda4243ceac67143ed73139b8d0cd1acbb2472e8 100644 (file)
@@ -1,7 +1,40 @@
-#file used to set environement configuration
+#file used to set environment configuration
+#Used for developpement purpose ONLY
 #------------------------------------------------
-#Defining Certificate for the application
-CA_ROOT        =       "/etc/pki/mailleur/certs/root-safe_CA.pem"
-CA_CERT        =       "/etc/pki/mailleur/mailleur-chain-cert_x509.pem"
-CA_KEY =       "/etc/pki/mailleur/mailleur-key.pem"
+#list of listening port to do SMTP protocole
+#format
+#protocol:ipnum:port:iteration[,protocol:ipnum:port:iteration]++
+#example
+#stmtps:ipnum:465:5    -> protocol smtps:IP number:port 465:5 iterations
+#:ipnum:::             -> smtp:ipnum:25:2
+#::,smtps::465:2       -> smtp:0.0.0.0:25:2 + smtps::465:2
+#::                    -> smtp:0.0.0.0:25:2
+#SMTPPORTS     "       "::"
+#SMTPPORTS     =       ":127.127.10.25:1025:,smtps:127.127.10.25:1026:1"
+SMTPPORTS      =       ":127.127.10.25:1025:"
+#SMTPPORTS     =       "smtps:127.127.10.25:1065:1"
+#------------------------------------------------
+#defining default domain
+DFLTDOMAIN     =       "example.com"
+#------------------------------------------------
+#Defining SERVER mode Certificate data
+CA_ROOT_SRV    =       "./certs/root-safe_CA.pem"
+CA_CERT_SRV    =       "./certs/mailleur_server-chain-cert_x509.pem"
+CA_KEY_SRV     =       "./certs/mailleur_server-key.pem"
+CA_VERIFY_SRV  =       1       #to check PEER/client remote certificate
+#------------------------------------------------
+#Defining CLIENT mode Certificate data
+CA_ROOT_CLT    =       "./certs/root-safe_CA.pem"
+CA_CERT_CLT    =       "./certs/localhost-chain-cert.pem"
+CA_KEY_CLT     =       "./certs/localhost-key.pem"
+CA_VERIFY_CLT  =       0       #to check PEER/server remote certificate
+#------------------------------------------------
+#Configured for Postgresql database
+DB_TYPE                =       POSTGRES
+DB_NAME                =       mailleur
+DB_HOST                =       localhost
+DB_PORT                =       5432
+#------------------------------------------------
+#Dovecot storage directory
+DOV_MAILDIR    =       "/var/spool/mailleur/mails"
 #------------------------------------------------
index 5f73775fc019afe76631565f7c88fe1d55cdecf5..795a69e5d55262b89b069eda815d138187597cd1 100644 (file)
@@ -23,12 +23,108 @@ search about email exchange within time and transaction context.
 #-----------------------------------------------------------------------------
 %files                 
 %defattr(-,root,root,-)
+%attr(0644,%{name},mail) %config(noreplace) %{_sysconfdir}/%{name}/*
 %{_sbindir}/chkspf
-%{_sbindir}/feeder
 %{_sbindir}/receiver
 %{_sbindir}/sender
 %{_sbindir}/sorter
 
+#-----------------------------------------------------------------------------
+
+%preun
+OS=`%{_libdir}/%{name}/shell/getsysos.sh`
+if [ "$1" = 0 ]; then
+  case "$OS" in
+    "sysv"     |                               \
+    "osukiss"  )
+      %{_initrddir}/%{name} stop > /dev/null 2>&1 || :
+      %{_sbindir}/chkconfig --del %{name}
+      #removing remaining init synlink
+      %{__rm} %{_initrddir}/%{name}
+      ;;
+    *          )
+      echo "Unable to find distribution"
+      exit -1
+      ;;
+    esac
+  %{_sbindir}/userdel %{name}
+  (
+  /bin/echo -n "%{name}-%{version} has been fully removed on "; date
+  /bin/echo "remaining file in this directory are data-base and logs"
+  /bin/echo "created while %{name} was in production."
+  /bin/echo "these files _may_ be removed too, but that they could"
+  /bin/echo "contain valuable data and admin should be careful"
+  /bin/echo "when removing them."
+  ) > %{_var}/log/README-%{name}-removed
+  fi
+
+%pre
+if [ ! "$(getent passwd %{name})" ]; then
+  %{_sbindir}/useradd                          \
+        -r                                     \
+        -c "%{name} daemon"                    \
+        -K SYS_UID_MIN=50                      \
+        -K SYS_UID_MAX=99                      \
+        -g mail                                        \
+        -s /usr/bin/bash                       \
+        -d %{_var}/spool/%{name}               \
+        %{name}
+  fi
+
+%post
+OS=`%{_libdir}/%{name}/shell/getsysos.sh`
+if [ "$1" = 1 ]; then
+  (
+  echo "#------------------------------------------"
+  echo "#Architecture type was set by rpm first install procedure"
+  echo "#"`date`
+  echo "AP_ARCH=%{_arch}"
+  echo "#------------------------------------------"
+  ) >> %{_sysconfdir}/sysconfig/%{name}
+  #installing init file according OS
+  case "$OS" in
+    "sysv"     |                                       \
+    "osukiss"  )
+      %{__ln_s}                                                \
+       %{_datadir}/%{name}/linux/$OS/%{name}           \
+       %{_initrddir}/%{name}
+      ;;
+    *          )
+      echo "Unable to find distribution"
+      exit -1
+      ;;
+    esac
+  fi
+case "$OS" in
+  "sysv"       |                                       \
+  "osukiss"    )
+    %{_sbindir}/chkconfig --add %{name}
+    %{_sysconfdir}/rc.d/init.d/%{name} condrestart > /dev/null 2>&1 || :
+    ;;
+  *            )
+    echo "Unable to find distribution"
+    exit -1
+    ;;
+  esac
+
+#=============================================================================
+%package               postgresql
+Summary                :       mailleur using postgresql as Data-base
+
+#-----------------------------------------------------------------------------
+BuildRequires  :       postgresql
+
+Requires       :       postgresql-server
+
+#-----------------------------------------------------------------------------
+%description           postgresql
+'%{name}' is configured to work with POSTGRESQL type database
+
+#-----------------------------------------------------------------------------
+%files                 postgresql
+%defattr(-,root,root,-)
+%{_sbindir}/feeder
+
 #=============================================================================
 %prep
 %setup -q