#--------------------------------------------------------------------
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 = \
#--------------------------------------------------------------------
#Managing testarea
SBINDIR = usr/sbin
+ETCDIR = etc
CURDIR = $(shell pwd)
#--------------------------------------------------------------------
.PHONY: clean cleanrpm
@ 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
+++ /dev/null
-#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"
-#------------------------------------------------
-#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"
#------------------------------------------------
#-----------------------------------------------------------------------------
%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