From 26e580bd850bbbfc2b39177ee272ab052c012b49 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Tue, 10 Sep 2013 12:04:33 -0500
Subject: postfix: readd for R8 and update to 2.10.2. refs #922

---
 abs/extra/postfix/PKGBUILD          |  94 +++++++++++++++++++-----------------
 abs/extra/postfix/aliases.patch     |  18 +++++++
 abs/extra/postfix/install           |  18 +++++++
 abs/extra/postfix/postfix           |  58 ----------------------
 abs/extra/postfix/postfix.install   |  38 ---------------
 abs/extra/postfix/postfix.patch.bz2 | Bin 373 -> 0 bytes
 abs/extra/postfix/service           |  14 ++++++
 7 files changed, 100 insertions(+), 140 deletions(-)
 create mode 100644 abs/extra/postfix/aliases.patch
 create mode 100644 abs/extra/postfix/install
 delete mode 100755 abs/extra/postfix/postfix
 delete mode 100644 abs/extra/postfix/postfix.install
 delete mode 100644 abs/extra/postfix/postfix.patch.bz2
 create mode 100644 abs/extra/postfix/service

diff --git a/abs/extra/postfix/PKGBUILD b/abs/extra/postfix/PKGBUILD
index 159f9eb..86b79f6 100644
--- a/abs/extra/postfix/PKGBUILD
+++ b/abs/extra/postfix/PKGBUILD
@@ -1,52 +1,58 @@
-# $Id: PKGBUILD 70372 2010-02-26 13:35:23Z paul $
+# $Id$
 # Contributor: Jeff Brodnax <tullyarcher@bellsouth.net>
-# Maintainer: Paul Mattal <paul@archlinux.org>
+# Contributor: Paul Mattal <paul@archlinux.org>
+# Maintainer: Gaetan Bisson <bisson@archlinux.org>
+
 pkgname=postfix
-pkgver=2.7.1
+pkgver=2.10.2
 pkgrel=1
-pkgdesc="Secure, fast, easy to administer drop in replacement for Sendmail (MTA)"
-arch=('i686' 'x86_64')
+pkgdesc='Fast, easy to administer, secure mail server'
+url='http://www.postfix.org/'
 license=('custom')
-depends=('pcre' 'libsasl'   'db>=4.7')
-backup=(etc/postfix/aliases etc/postfix/virtual etc/postfix/relocated \
-	etc/postfix/access etc/postfix/header_checks etc/postfix/transport \
-	etc/postfix/generic etc/postfix/canonical \
-	etc/postfix/main.cf etc/postfix/master.cf)
-install="${pkgname}.install"
+arch=('i686' 'x86_64')
+depends=('pcre' 'libsasl' 'db')
+backup=('etc/postfix/'{access,aliases,canonical,generic,header_checks,main.cf,master.cf,relocated,transport,virtual})
+source=("ftp://ftp.porcupine.org/mirrors/postfix-release/official/${pkgname}-${pkgver}.tar.gz"{,.sig}
+        'aliases.patch'
+        'service')
+sha1sums=('4721024784d071c3e663d610db17f8bd99821f3d' 'SKIP'
+          '5fc3de6c7df1e5851a0a379e825148868808318b'
+          'dd12885d367bebaf0fc9d2e9823a7f82086b6ee9')
+
 provides=('smtp-server' 'smtp-forwarder')
-replaces=('postfix-mysql' 'postfix-pgsql')
-conflicts=('postfix-mysql' 'postfix-pgsql' 'smtp-server' 'smtp-forwarder')
-url="http://www.postfix.org/"
-source=(ftp://ftp.porcupine.org/mirrors/postfix-release/official/${pkgname}-${pkgver}.tar.gz \
-        ${pkgname}.patch.bz2 \
-	${pkgname})
+conflicts=('smtp-server' 'smtp-forwarder')
+
+install=install
 
 build() {
-	cd ${srcdir}/${pkgname}-${pkgver}
-	
-	make makefiles \
-	        CCARGS="-DUSE_SASL_AUTH -I/usr/include/sasl \
-			-DUSE_CYRUS_SASL \
-			-DUSE_TLS" \
-	        AUXLIBS="-lsasl2 -lssl -lcrypto  -llber -lz -lm "
-	make OPT="${CFLAGS}" || return 1
-
-	sh postfix-install -non-interactive \
-		install_root="${pkgdir}" \
-		daemon_directory="/usr/lib/${pkgname}" \
-		sample_directory="/etc/${pkgname}/sample" \
-		manpage_directory="/usr/share/man"
-
-	cd ${pkgdir}
-	cat ${srcdir}/${pkgname}.patch |patch -Np0 || return 1
-	rm -f etc/${pkgname}/main.cf~
-
-	cd ${pkgdir}
-	mkdir etc/rc.d
-	install -m 0755 ${srcdir}/${pkgname} etc/rc.d/${pkgname}
-
-	install -Dm644 ${srcdir}/${pkgname}-${pkgver}/LICENSE ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE
+	cd "${srcdir}/${pkgname}-${pkgver}"
+
+	make makefiles DEBUG='' CCARGS=' \
+		-DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl \
+		-DUSE_TLS \
+		-DDEF_COMMAND_DIR=\"/usr/bin\" \
+		-DDEF_DAEMON_DIR=\"/usr/lib/postfix\" \
+		-DDEF_SENDMAIL_PATH=\"/usr/bin/sendmail\" \
+#		-DDEF_README_DIR=\"/usr/share/doc/postfix\" \
+		-DDEF_SAMPLE_DIR=\"/etc/postfix/sample\" \
+		-DDEF_MANPAGE_DIR=\"/usr/share/man\" \
+	' AUXLIBS=' \
+		-lsasl2 \
+		-lssl -lcrypto \
+	' OPT="${CFLAGS} ${LDFLAGS}"
+
+	make
+}
+
+package() {
+	cd "${srcdir}/${pkgname}-${pkgver}"
+
+	sh postfix-install -non-interactive install_root="${pkgdir}"
+
+	install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+	install -Dm644 ../service "${pkgdir}/usr/lib/systemd/system/${pkgname}.service"
+
+	cd "${pkgdir}"
+	patch -p0 -i "${srcdir}"/aliases.patch
+	sed 's/^\(\$manpage[^:]*\):/\1.gz:/' -i "usr/lib/${pkgname}/postfix-files"
 }
-md5sums=('b7a5c3ccd309156a65d6f8d2683d4fa1'
-         'a3c45ff23ef036143711793fcf2478c3'
-         'c847b96f08925f08b0f610468a8e21f6')
diff --git a/abs/extra/postfix/aliases.patch b/abs/extra/postfix/aliases.patch
new file mode 100644
index 0000000..6767870
--- /dev/null
+++ b/abs/extra/postfix/aliases.patch
@@ -0,0 +1,18 @@
+--- etc/postfix/main.cf.orig	2010-12-13 20:18:22.000000000 +0100
++++ etc/postfix/main.cf	2010-12-13 20:18:24.000000000 +0100
+@@ -382,6 +382,7 @@
+ #alias_maps = hash:/etc/aliases
+ #alias_maps = hash:/etc/aliases, nis:mail.aliases
+ #alias_maps = netinfo:/aliases
++alias_maps = hash:/etc/postfix/aliases
+ 
+ # The alias_database parameter specifies the alias database(s) that
+ # are built with "newaliases" or "sendmail -bi".  This is a separate
+@@ -392,6 +393,7 @@
+ #alias_database = dbm:/etc/mail/aliases
+ #alias_database = hash:/etc/aliases
+ #alias_database = hash:/etc/aliases, hash:/opt/majordomo/aliases
++alias_database = $alias_maps
+ 
+ # ADDRESS EXTENSIONS (e.g., user+foo)
+ #
diff --git a/abs/extra/postfix/install b/abs/extra/postfix/install
new file mode 100644
index 0000000..c7e06b0
--- /dev/null
+++ b/abs/extra/postfix/install
@@ -0,0 +1,18 @@
+post_upgrade() {
+	/usr/lib/postfix/post-install daemon_directory=/usr/lib/postfix command_directory=/usr/bin upgrade-package
+	chown postfix var/lib/postfix
+}
+
+post_install() {
+	getent group postdrop &>/dev/null || groupadd -g 75 postdrop >/dev/null
+	getent group postfix  &>/dev/null || groupadd -g 73 postfix  >/dev/null
+	getent passwd postfix &>/dev/null || useradd -u 73 -d /var/spool/postfix -g postfix -s /bin/false postfix >/dev/null
+	post_upgrade
+}
+
+pre_remove() {
+	getent passwd postfix &>/dev/null && userdel  postfix  >/dev/null
+	getent group postfix  &>/dev/null && groupdel postfix  >/dev/null
+	getent group postdrop &>/dev/null && groupdel postdrop >/dev/null
+	true
+}
diff --git a/abs/extra/postfix/postfix b/abs/extra/postfix/postfix
deleted file mode 100755
index 37dd6a8..0000000
--- a/abs/extra/postfix/postfix
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/bin/bash
-
-. /etc/rc.conf
-. /etc/rc.d/functions
-
-PID=`pgrep -f /usr/lib/postfix/master`
-
-start() {
-  stat_busy "Starting Postfix"
-  [ -z "$PID" ] && /usr/sbin/postfix start &> /dev/null
-  if [ $? -gt 0 ]; then
-    stat_fail
-  else
-    add_daemon postfix
-    stat_done
-  fi
-}
-
-stop() {
-  stat_busy "Stopping Postfix"
-  [ ! -z "$PID" ]  && /usr/sbin/postfix stop &> /dev/null
-  if [ $? -gt 0 ]; then
-    stat_fail
-  else
-    rm_daemon postfix
-    stat_done
-  fi
-}
-
-reload() {
-  stat_busy "Reloading Postfix"
-  [ ! -z "$PID" ] && kill -HUP $PID &> /dev/null
-  if [ $? -gt 0 ]; then
-    stat_fail
-  else
-    stat_done
-  fi
-}
-
-case "$1" in
-  start)
-    start
-    ;;
-  stop)
-    stop
-    ;;
-  restart)
-    # calling 'stop' and 'start' without the $0 fails...
-    $0 stop
-    $0 start
-    ;;
-  reload)
-    reload
-    ;;
-  *)
-    echo "usage: $0 {start|stop|restart|reload}"
-esac
-exit 0
diff --git a/abs/extra/postfix/postfix.install b/abs/extra/postfix/postfix.install
deleted file mode 100644
index bac3e1d..0000000
--- a/abs/extra/postfix/postfix.install
+++ /dev/null
@@ -1,38 +0,0 @@
-# arg 1:  the new package version
-post_install() {
-    if [ -z "`grep '^postdrop::' /etc/group`" ]; then
-	groupadd -g 75 postdrop >& /dev/null
-    fi
-    if [ -z "`grep '^postfix::' /etc/group`" ]; then
-	groupadd -g 73 postfix >& /dev/null
-    fi
-    if [ -z "`grep '^postfix:' /etc/passwd`" ]; then
-	useradd -u 73 -d /var/spool/postfix -g postfix -s /bin/false postfix
-    else
-	# fix a packaging bug from before (postfix should have no shell)
-	usermod -s /bin/false postfix
-    fi
-
-    chown postfix var/spool/postfix/{active,bounce,corrupt,defer,deferred,\
-flush,hold,incoming,private,public,maildrop,trace,saved}
-    chown postfix var/lib/postfix
-    chgrp postdrop var/spool/postfix/{public,maildrop}
-    chgrp postdrop usr/sbin/postqueue
-    chgrp postdrop usr/sbin/postdrop
-    chmod g+s usr/sbin/{postqueue,postdrop}
-
-    newaliases
-}
-
-# arg 1:  the new package version
-# arg 2:  the old package version
-post_upgrade() {
-    post_install $1
-}
-
-# arg 1:  the old package version
-pre_remove() {
-    userdel postfix &> /dev/null
-    groupdel postfix &> /dev/null
-    groupdel postdrop &> /dev/null
-}
diff --git a/abs/extra/postfix/postfix.patch.bz2 b/abs/extra/postfix/postfix.patch.bz2
deleted file mode 100644
index dbc0950..0000000
Binary files a/abs/extra/postfix/postfix.patch.bz2 and /dev/null differ
diff --git a/abs/extra/postfix/service b/abs/extra/postfix/service
new file mode 100644
index 0000000..a7cdc53
--- /dev/null
+++ b/abs/extra/postfix/service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Postfix Mail Transport Agent
+After=network.target
+
+[Service]
+Type=forking
+PIDFile=/var/spool/postfix/pid/master.pid
+ExecStart=/usr/bin/postfix start
+ExecStop=/usr/bin/postfix stop
+ExecReload=/usr/bin/postfix reload
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
-- 
cgit v0.12

