From: Marcin Krol Date: Fri, 25 Jan 2019 11:47:55 +0000 (+0100) Subject: - migrate configuration to /etc/postfix X-Git-Url: https://git.tld-linux.org/?a=commitdiff_plain;h=6bfc6f70edeec380c113a192aa15cfb94d0a5d5b;p=packages%2Fpostfix.git - migrate configuration to /etc/postfix --- diff --git a/postfix-config.patch b/postfix-config.patch index 0d5918e..f6c1c62 100644 --- a/postfix-config.patch +++ b/postfix-config.patch @@ -33,7 +33,7 @@ diff -ur postfix-3.0.2.orig/conf/main.cf postfix-3.0.2/conf/main.cf # #alias_maps = dbm:/etc/aliases -#alias_maps = hash:/etc/aliases -+alias_maps = hash:/etc/mail/aliases ++alias_maps = hash:/etc/postfix/aliases #alias_maps = hash:/etc/aliases, nis:mail.aliases #alias_maps = netinfo:/aliases @@ -42,7 +42,7 @@ diff -ur postfix-3.0.2.orig/conf/main.cf postfix-3.0.2/conf/main.cf #alias_database = dbm:/etc/aliases #alias_database = dbm:/etc/mail/aliases -#alias_database = hash:/etc/aliases -+alias_database = hash:/etc/mail/aliases ++alias_database = hash:/etc/postfix/aliases #alias_database = hash:/etc/aliases, hash:/opt/majordomo/aliases # ADDRESS EXTENSIONS (e.g., user+foo) @@ -137,11 +137,11 @@ diff -ur postfix-3.0.2.orig/src/util/sys_defs.h postfix-3.0.2/src/util/sys_defs. --- postfix-3.0.2.orig/src/util/sys_defs.h 2015-07-18 13:28:17.000000000 +0000 +++ postfix-3.0.2/src/util/sys_defs.h 2015-07-25 15:53:06.028514288 +0000 @@ -55,7 +55,7 @@ - #define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/mail/aliases" /* OpenBSD 2.7 */ + #define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/postfix/aliases" /* OpenBSD 2.7 */ #endif #ifndef ALIAS_DB_MAP -#define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/aliases" -+#define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/mail/aliases" ++#define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/postfix/aliases" #endif #define GETTIMEOFDAY(t) gettimeofday(t,(struct timezone *) 0) #define ROOT_PATH "/bin:/usr/bin:/sbin:/usr/sbin" diff --git a/postfix.spec b/postfix.spec index c4d01ce..4dbbc84 100644 --- a/postfix.spec +++ b/postfix.spec @@ -18,7 +18,7 @@ Summary(pt_BR.UTF-8): Postfix - Um MTA (Mail Transport Agent) de alto desempenho Summary(sk.UTF-8): Agent prenosu pošty Postfix Name: postfix Version: 3.3.2 -Release: 1 +Release: 2 Epoch: 2 License: distributable Group: Networking/Daemons/SMTP @@ -242,9 +242,6 @@ Plik monitrc do monitorowania serwera Postfix. %prep %setup -q - -find -type f | xargs sed -i -e 's|/etc/postfix|/etc/mail|g' - %patch0 -p1 %patch1 -p1 %patch2 -p1 @@ -276,7 +273,7 @@ export CC %install rm -rf $RPM_BUILD_ROOT install -d $RPM_BUILD_ROOT/etc/{cron.daily,rc.d/init.d,sysconfig,pam.d,security,monit} \ - $RPM_BUILD_ROOT%{_sysconfdir}/{mail,sasl} \ + $RPM_BUILD_ROOT%{_sysconfdir}/{postfix,sasl} \ $RPM_BUILD_ROOT{%{_bindir},%{_sbindir},%{_libdir}/postfix,/usr/lib}\ $RPM_BUILD_ROOT{%{_includedir}/postfix,%{_mandir}} \ $RPM_BUILD_ROOT%{_var}/spool/postfix/{active,corrupt,deferred,maildrop,private,saved,bounce,defer,incoming,pid,public} \ @@ -288,12 +285,12 @@ install -p bin/* $RPM_BUILD_ROOT%{_sbindir} install -p libexec/* $RPM_BUILD_ROOT%{_libdir}/postfix ln $RPM_BUILD_ROOT%{_libdir}/postfix/smtp $RPM_BUILD_ROOT%{_libdir}/postfix/lmtp ln $RPM_BUILD_ROOT%{_libdir}/postfix/qmgr $RPM_BUILD_ROOT%{_libdir}/postfix/nqmgr -cp -a conf/* $RPM_BUILD_ROOT%{_sysconfdir}/mail +cp -a conf/* $RPM_BUILD_ROOT%{_sysconfdir}/postfix sed -e's,^daemon_directory = .*,daemon_directory = %{_libdir}/postfix,' \ - conf/main.cf > $RPM_BUILD_ROOT%{_sysconfdir}/mail/main.cf + conf/main.cf > $RPM_BUILD_ROOT%{_sysconfdir}/postfix/main.cf sed -e 's,${LIB_PREFIX},%{_libdir}/postfix/postfix-,g;s,${LIB_SUFFIX},.so,g' \ - conf/dynamicmaps.cf > $RPM_BUILD_ROOT%{_sysconfdir}/mail/dynamicmaps.cf + conf/dynamicmaps.cf > $RPM_BUILD_ROOT%{_sysconfdir}/postfix/dynamicmaps.cf for f in dns global master util tls; do cp -a lib/libpostfix-${f}.so $RPM_BUILD_ROOT%{_libdir}/libpostfix-${f}.so.1 @@ -306,14 +303,14 @@ cp -a include/*.h $RPM_BUILD_ROOT%{_includedir}/postfix cp -a man/man* $RPM_BUILD_ROOT%{_mandir} -cp -a %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/mail/aliases +cp -a %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/postfix/aliases install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/cron.daily/postfix install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/postfix cp -a %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/postfix cp -a %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/sasl/smtpd.conf cp -a %{SOURCE6} $RPM_BUILD_ROOT/etc/pam.d/smtp -cp -a %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/mail/bounce.cf.pl -cp -a %{SOURCE8} $RPM_BUILD_ROOT%{_sysconfdir}/mail/bounce.cf.de +cp -a %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/postfix/bounce.cf.pl +cp -a %{SOURCE8} $RPM_BUILD_ROOT%{_sysconfdir}/postfix/bounce.cf.de cp -a %{SOURCE9} $RPM_BUILD_ROOT/etc/monit/%{name}.monitrc install -p auxiliary/rmail/rmail $RPM_BUILD_ROOT%{_bindir}/rmail install -p auxiliary/qshape/qshape.pl $RPM_BUILD_ROOT%{_bindir}/qshape @@ -322,17 +319,17 @@ ln -sf %{_sbindir}/sendmail $RPM_BUILD_ROOT%{_bindir}/mailq ln -sf %{_sbindir}/sendmail $RPM_BUILD_ROOT%{_bindir}/newaliases ln -sf %{_sbindir}/sendmail $RPM_BUILD_ROOT/usr/lib/sendmail -touch $RPM_BUILD_ROOT%{_sysconfdir}/mail/\ +touch $RPM_BUILD_ROOT%{_sysconfdir}/postfix/\ {aliases,access,canonical,relocated,transport,virtual}{,.db} touch $RPM_BUILD_ROOT/etc/security/blacklist.smtp > $RPM_BUILD_ROOT/var/spool/postfix/.nofinger -%{__rm} -rf $RPM_BUILD_ROOT%{_sysconfdir}/mail/makedefs.out -%{__rm} -f $RPM_BUILD_ROOT%{_sysconfdir}/mail/TLS_LICENSE +%{__rm} -rf $RPM_BUILD_ROOT%{_sysconfdir}/postfix/makedefs.out +%{__rm} -f $RPM_BUILD_ROOT%{_sysconfdir}/postfix/TLS_LICENSE -%{__rm} -f $RPM_BUILD_ROOT%{_sysconfdir}/mail/{postfix-script,postfix-tls-script,postfix-wrapper,post-install,postmulti-script} +%{__rm} -f $RPM_BUILD_ROOT%{_sysconfdir}/postfix/{postfix-script,postfix-tls-script,postfix-wrapper,post-install,postmulti-script} %clean rm -rf $RPM_BUILD_ROOT @@ -344,14 +341,14 @@ rm -rf $RPM_BUILD_ROOT %post /sbin/ldconfig -if ! grep -q "^postmaster:" %{_sysconfdir}/mail/aliases; then - echo "Adding Entry for postmaster in %{_sysconfdir}/mail/aliases" >&2 - echo "postmaster: root" >>%{_sysconfdir}/mail/aliases +if ! grep -q "^postmaster:" %{_sysconfdir}/postfix/aliases; then + echo "Adding Entry for postmaster in %{_sysconfdir}/postfix/aliases" >&2 + echo "postmaster: root" >>%{_sysconfdir}/postfix/aliases fi if [ "$1" = "1" ]; then # only on installation, not upgrade; set sane defaults # postfix expects gethostname() to return FQDN, which is obviously wrong - if ! grep -qE "^my(domain|hostname)" %{_sysconfdir}/mail/main.cf; then + if ! grep -qE "^my(domain|hostname)" %{_sysconfdir}/postfix/main.cf; then domain=$(/bin/hostname -d 2>/dev/null) [ -n "$domain" -a "$domain" != 'localdomain' ] && \ postconf -e mydomain="$domain" @@ -378,29 +375,61 @@ if [ "$1" = "0" ]; then %groupremove postfix fi +%triggerun -- %{name} < 2:3.3.2-2 +if [ $1 -le 1 ]; then + exit 0 +fi +set -x +for f in /etc/mail/{access,aliases,body_checks,bounce.cf.*,canonical,dynamicmaps.cf,generic,header_checks,main.cf,master.cf,postfix-files,relocated,transport,virtual}; do + f=${f##*/} + [ -f "/etc/mail/$f" ] && mv "/etc/mail/$f" "/etc/postfix/$f" 2>/dev/null || : +done +find /etc/postfix -type f 2>/dev/null | xargs sed -i -e 's|/etc/mail|/etc/postfix|g' 2>/dev/null +for f in /etc/mail/*.db; do + f=${f##*/} + [ "$f" = "*.db" ] && break + [ -f "/etc/mail/$f" ] && rm "/etc/mail/$f" 2>/dev/null || : + f=${f%%.db} + [ -f "/etc/mail/$f" ] && mv "/etc/mail/$f" /etc/postfix 2>/dev/null || : + if [ "$f" = "aliases" ]; then + /usr/sbin/postalias "/etc/postfix/aliases" 2>/dev/null || : + else + /usr/sbin/postmap "/etc/postfix/$f" 2>/dev/null || : + fi +done +[ -n "$(find /etc/mail -type d -empty 2>/dev/null)" ] && rmdir /etc/mail 2>/dev/null || : +set +x + +%triggerpostun -- %{name} < 2:3.3.2-2 +echo +echo "Warning! Configuration has been migrated to /etc/postfix." +echo "It may be required to move some files manually from /etc/mail" +echo "to /etc/postfix and/or run postmap on some files in /etc/postfix." +echo + %files %defattr(644,root,root,755) %doc html COMPATIBILITY HISTORY LICENSE RELEASE_NOTES* TLS_* %doc README_FILES/*README %doc examples/smtpd-policy -%dir %{_sysconfdir}/mail -%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mail/access -%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mail/aliases -%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mail/bounce.cf.default -%lang(de) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mail/bounce.cf.de -%lang(pl) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mail/bounce.cf.pl -%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mail/canonical -%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mail/generic -#%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mail/regexp_table -%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mail/relocated -%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mail/transport -%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mail/virtual -%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mail/header_checks -#%ghost %{_sysconfdir}/mail/*.db -%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mail/dynamicmaps.cf -%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mail/main.cf -%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mail/master.cf -%{_sysconfdir}/mail/postfix-files +%dir %{_sysconfdir}/postfix +%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/postfix/access +%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/postfix/aliases +%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/postfix/bounce.cf.default +%lang(de) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/postfix/bounce.cf.de +%lang(pl) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/postfix/bounce.cf.pl +%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/postfix/canonical +%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/postfix/generic +#%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/postfix/regexp_table +%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/postfix/relocated +%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/postfix/transport +%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/postfix/virtual +%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/postfix/header_checks +#%ghost %{_sysconfdir}/postfix/*.db +%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/postfix/dynamicmaps.cf +%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/postfix/main.cf +%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/postfix/master.cf +%{_sysconfdir}/postfix/postfix-files %attr(740,root,root) /etc/cron.daily/postfix %attr(754,root,root) /etc/rc.d/init.d/postfix %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/postfix