summaryrefslogtreecommitdiff
path: root/user
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-01-22 05:59:20 +0000
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-01-22 05:59:20 +0000
commite8742fac72237e98c50465c7025734ef5dd30fb4 (patch)
tree22b2223bdbaf04a91f46c9b2b5a5b7b77c8a929c /user
parentf24ed16dccb1bd1f14309a047dbb4057077c2cb3 (diff)
downloadpackages-e8742fac72237e98c50465c7025734ef5dd30fb4.tar.gz
packages-e8742fac72237e98c50465c7025734ef5dd30fb4.tar.bz2
packages-e8742fac72237e98c50465c7025734ef5dd30fb4.tar.xz
packages-e8742fac72237e98c50465c7025734ef5dd30fb4.zip
user/postfix: new package
Diffstat (limited to 'user')
-rw-r--r--user/postfix/APKBUILD92
-rw-r--r--user/postfix/honour-config-directory.patch11
-rw-r--r--user/postfix/postfix.initd85
-rw-r--r--user/postfix/postfix.pre-install5
4 files changed, 193 insertions, 0 deletions
diff --git a/user/postfix/APKBUILD b/user/postfix/APKBUILD
new file mode 100644
index 000000000..a48fcc7bd
--- /dev/null
+++ b/user/postfix/APKBUILD
@@ -0,0 +1,92 @@
+# Contributor: A. Wilcox <awilfox@adelielinux.org>
+# Maintainer: Dan Theisen <djt@hxx.in>
+pkgname=postfix
+pkgver=3.3.2
+pkgrel=0
+pkgdesc="Mail server (MTA) that is Sendmail outside and Qmail inside"
+url="http://www.postfix.org/"
+arch="all"
+options="!check suid" # No test suite.
+license="EPL-2.0 AND IPL-1.0"
+depends=""
+makedepends="cyrus-sasl-dev db-dev icu-dev linux-pam-dev lmdb-dev openldap-dev
+ openssl-dev pcre-dev perl postgresql-dev sqlite-dev"
+install="$pkgname.pre-install"
+subpackages="$pkgname-doc $pkgname-ldap $pkgname-lmdb $pkgname-pgsql
+ $pkgname-sqlite"
+pkgusers="postfix"
+pkggroups="postfix postdrop"
+source="http://www.namesdir.com/mirrors/postfix-release/official/postfix-$pkgver.tar.gz
+ honour-config-directory.patch
+ postfix.initd
+ "
+
+build() {
+ cd "$builddir"
+ local CCARGS="-DHAS_LDAP -DHAS_LMDB -DHAS_PCRE -DHAS_PGSQL -I$(pg_config --includedir) -DHAS_SQLITE -DNO_NIS -DUSE_CYRUS_SASL -DUSE_SASL_AUTH -I/usr/include/sasl -DUSE_LDAP_SASL -DUSE_TLS -Wno-comment"
+ local AUXLIBS="-lpam $(pcre-config --libs) -lsasl2 -lssl -lcrypto"
+ make DEBUG="" shared=yes dynamicmaps=yes pie=yes \
+ config_directory="/etc/postfix" \
+ daemon_directory="/usr/libexec/postfix" \
+ meta_directory="/etc/postfix" \
+ shlib_directory="/usr/lib/postfix" \
+ CC="gcc" OPT="$CFLAGS" CCARGS="$CCARGS" AUXLIBS="$AUXLIBS" \
+ AUXLIBS_LDAP="-lldap -llber" AUXLIBS_LMDB="-llmdb" \
+ AUXLIBS_PCRE="$(pcre-config --libs)" \
+ AUXLIBS_PGSQL="-L$(pg_config --libdir) -lpq" \
+ AUXLIBS_SQLITE="$(pkgconf --libs sqlite3)" \
+ makefiles
+}
+
+package() {
+ cd "$builddir"
+ make install_root="$pkgdir" manpage_directory="/usr/share/man" \
+ command_directory="/usr/sbin" mailq_path="/usr/bin/mailq" \
+ newaliases_path="/usr/bin/newaliases" \
+ sendmail_path="/usr/sbin/sendmail" \
+ non-interactive-package
+
+ mkdir -p "$pkgdir"/etc/apk/protected_paths.d
+ cat > "$pkgdir"/etc/apk/protected_paths.d/postfix.list <<-EOF
+ !var/lib/postfix
+ !var/spool/postfix
+ EOF
+
+ chown -R postfix:postfix \
+ "$pkgdir"/var/lib/postfix \
+ "$pkgdir"/var/spool/postfix
+ chmod 0750 "$pkgdir"/var/lib/postfix
+ chgrp postdrop "$pkgdir"/usr/sbin/postdrop "$pkgdir"/usr/sbin/postqueue
+ chmod 2755 "$pkgdir"/usr/sbin/postdrop "$pkgdir"/usr/sbin/postqueue
+}
+
+_database() {
+ pkgdesc="Postfix mapping plugin for storing users in $2"
+
+ install -d "$subpkgdir"/etc/postfix/dynamicmaps.cf.d
+ grep $1 "$pkgdir"/etc/postfix/dynamicmaps.cf > \
+ "$subpkgdir"/etc/postfix/dynamicmaps.cf.d/$1
+ sed -i "/$1/d" "$pkgdir"/etc/postfix/dynamicmaps.cf
+ install -d "$subpkgdir"/usr/lib/postfix
+ mv "$pkgdir"/usr/lib/postfix/postfix-$1.so "$subpkgdir"/usr/lib/postfix/
+}
+
+ldap() {
+ _database "ldap" "LDAP"
+}
+
+lmdb() {
+ _database "lmdb" "LMDB"
+}
+
+pgsql() {
+ _database "pgsql" "PostgreSQL"
+}
+
+sqlite() {
+ _database "sqlite" "SQLite 3"
+}
+
+sha512sums="df67eb978751900d357597def16f744dae990f5cc4e48af8dca57f84b0140e05416712727c1760b8f557ed3564cd593620756561b0a6f31db4b54d928e15293f postfix-3.3.2.tar.gz
+63ea7fe461fca1306088e9984acfab6ab3e919dafa2b606d43fbca472969e6ec232800071f939f5a4482c01c6d7b53a86de9e7e893ab94f4cb135d16ff5763cc honour-config-directory.patch
+2ad1b053bbb51d4f480dbf5a01252e8e99a82ec14a75ff49336b2b190ea55bc02400542b109fa0cc4ebfe6b42eaabbc45f70f2ea581f1eb9c4189c439b825592 postfix.initd"
diff --git a/user/postfix/honour-config-directory.patch b/user/postfix/honour-config-directory.patch
new file mode 100644
index 000000000..a32c588ee
--- /dev/null
+++ b/user/postfix/honour-config-directory.patch
@@ -0,0 +1,11 @@
+--- postfix-3.3.2/postfix-install
++++ postfix-3.3.2/postfix-install
+@@ -832,7 +832,7 @@
+ # the wrong place when Postfix is being upgraded.
+
+ case "$mail_version" in
+-"") mail_version="`bin/postconf -dhx mail_version`" || exit 1
++"") mail_version="`bin/postconf -c $CONFIG_DIRECTORY -dhx mail_version`" || exit 1
+ esac
+
+ # Undo MAIL_VERSION expansion at the end of a parameter value. If
diff --git a/user/postfix/postfix.initd b/user/postfix/postfix.initd
new file mode 100644
index 000000000..9a1c1e21d
--- /dev/null
+++ b/user/postfix/postfix.initd
@@ -0,0 +1,85 @@
+#!/sbin/openrc-run
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+extra_started_commands="reload abort flush"
+
+description_reload="Re-read configuration files. Running processes terminate at their earliest convenience."
+description_abort="Stop the Postfix mail system abruptly. Running processes are signaled to stop immediately."
+description_flush="Force delivery: attempt to deliver every message in the deferred mail queue."
+
+# Please read http://www.postfix.org/MULTI_INSTANCE_README.html for multi instance support
+CONF_DIR="/etc/postfix"
+CONF_OPT="${SVCNAME##*.}"
+if [ -n ${CONF_OPT} -a ${SVCNAME} != "postfix" ]; then
+ CONF_DIR="${CONF_DIR}.${CONF_OPT}"
+fi
+if [ "${CONF_DIR}" = "/etc/postfix" ]; then
+ CONF_PARAM=""
+ CONF_MESSAGE=""
+else
+ CONF_PARAM="-c ${CONF_DIR}"
+ CONF_MESSAGE="(${CONF_DIR})"
+fi
+
+depend() {
+ use logger dns ypbind amavisd antivirus postfix_greylist net saslauthd
+ if [ "${SVCNAME}" = "postfix" ]; then
+ provide mta
+ fi
+}
+
+start() {
+ if [ ! -z "${CONF_PARAM}" ]; then
+ einfo "Please consider updating your config for postmulti support."
+ fi
+ ebegin "Starting postfix ${CONF_MESSAGE}"
+ if [ ! -d ${CONF_DIR} ]; then
+ eend 1 "${CONF_DIR} does not exist"
+ return 1
+ fi
+ /usr/sbin/postfix ${CONF_PARAM} start >/dev/null 2>&1
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping postfix ${CONF_MESSAGE}"
+ /usr/sbin/postfix ${CONF_PARAM} stop >/dev/null 2>&1
+ eend
+}
+
+status() {
+ local _retval
+ einfon ""
+ /usr/sbin/postfix ${CONF_PARAM} status
+ _retval=$?
+ if [ x${_retval} = 'x0' ]; then
+ mark_service_started "${SVCNAME}"
+ eend 0
+ else
+ mark_service_stopped "${SVCNAME}"
+ eend 3
+ fi
+}
+
+reload() {
+ ebegin "Reloading postfix ${CONF_MESSAGE}"
+ /usr/sbin/postfix ${CONF_PARAM} reload >/dev/null 2>&1
+ eend $?
+}
+
+abort() {
+ ebegin "Aborting postfix ${CONF_MESSAGE}"
+
+ if service_started "${SVCNAME}"; then
+ mark_service_stopped "${SVCNAME}"
+ fi
+ /usr/sbin/postfix ${CONF_PARAM} abort >/dev/null 2>&1
+ eend $?
+}
+
+flush() {
+ ebegin "Flushing postfix ${CONF_MESSAGE}"
+ /usr/sbin/postfix ${CONF_PARAM} flush >/dev/null 2>&1
+ eend $?
+}
diff --git a/user/postfix/postfix.pre-install b/user/postfix/postfix.pre-install
new file mode 100644
index 000000000..73ebdba3f
--- /dev/null
+++ b/user/postfix/postfix.pre-install
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+groupadd -g 207 -r postfix
+groupadd -g 208 -r postdrop
+useradd -u 207 -c "Postfix Mail Server" -M -N -G postfix,mail -r -s /sbin/nologin postfix