From: Jean-Marc Pigeon (Delson) Date: Mon, 16 Jun 2025 16:38:43 +0000 (-0400) Subject: Improving Spec file X-Git-Tag: tag-0.9~165 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=0c16f4344efeb2d579e20ba497f64c2a60aa9587;p=jmp%2Fmailleur Improving Spec file --- diff --git a/Makefile b/Makefile index b949a9c..8f98f0b 100644 --- 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 diff --git a/Makefile.dist b/Makefile.dist index c448c78..17d50e3 100644 --- a/Makefile.dist +++ b/Makefile.dist @@ -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 index 97277eb..0000000 --- a/conf/feeder.conf.dvl +++ /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" -#------------------------------------------------ diff --git a/conf/mailleur.conf b/conf/mailleur.conf index b26d459..dda4243 100644 --- a/conf/mailleur.conf +++ b/conf/mailleur.conf @@ -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" #------------------------------------------------ diff --git a/mailleur.spec.in b/mailleur.spec.in index 5f73775..795a69e 100644 --- a/mailleur.spec.in +++ b/mailleur.spec.in @@ -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