summaryrefslogtreecommitdiffstats
path: root/meta-openembedded/meta-networking/recipes-daemons/postfix
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openembedded/meta-networking/recipes-daemons/postfix')
-rw-r--r--meta-openembedded/meta-networking/recipes-daemons/postfix/files/0001-Check-for-glibc-before-setting-CANT_USE_SEND_RECV_MS.patch26
-rw-r--r--meta-openembedded/meta-networking/recipes-daemons/postfix/files/0001-makedefs-Use-native-compiler-to-build-makedefs.test.patch64
-rwxr-xr-xmeta-openembedded/meta-networking/recipes-daemons/postfix/files/aliasesdb20
-rwxr-xr-xmeta-openembedded/meta-networking/recipes-daemons/postfix/files/check_hostname.sh13
-rw-r--r--meta-openembedded/meta-networking/recipes-daemons/postfix/files/icu-config.patch21
-rw-r--r--meta-openembedded/meta-networking/recipes-daemons/postfix/files/install.patch93
-rw-r--r--meta-openembedded/meta-networking/recipes-daemons/postfix/files/internal_recipient1
-rw-r--r--meta-openembedded/meta-networking/recipes-daemons/postfix/files/main.cf105
-rw-r--r--meta-openembedded/meta-networking/recipes-daemons/postfix/files/makedefs.patch116
-rwxr-xr-xmeta-openembedded/meta-networking/recipes-daemons/postfix/files/postfix94
-rw-r--r--meta-openembedded/meta-networking/recipes-daemons/postfix/files/postfix-install.patch26
-rw-r--r--meta-openembedded/meta-networking/recipes-daemons/postfix/files/postfix.service16
-rw-r--r--meta-openembedded/meta-networking/recipes-daemons/postfix/postfix.inc262
-rw-r--r--meta-openembedded/meta-networking/recipes-daemons/postfix/postfix_3.2.2.bb9
14 files changed, 866 insertions, 0 deletions
diff --git a/meta-openembedded/meta-networking/recipes-daemons/postfix/files/0001-Check-for-glibc-before-setting-CANT_USE_SEND_RECV_MS.patch b/meta-openembedded/meta-networking/recipes-daemons/postfix/files/0001-Check-for-glibc-before-setting-CANT_USE_SEND_RECV_MS.patch
new file mode 100644
index 000000000..6b86e3925
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-daemons/postfix/files/0001-Check-for-glibc-before-setting-CANT_USE_SEND_RECV_MS.patch
@@ -0,0 +1,26 @@
+From 63619acf25151d4dade6d65732722ec4a710a5ac Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 15 Jul 2017 09:54:25 -0700
+Subject: [PATCH] Check for glibc before setting CANT_USE_SEND_RECV_MSG
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/util/sys_defs.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/util/sys_defs.h b/src/util/sys_defs.h
+index f720e2a..7314c63 100644
+--- a/src/util/sys_defs.h
++++ b/src/util/sys_defs.h
+@@ -813,7 +813,7 @@ extern int initgroups(const char *, int);
+ #define KERNEL_VERSION(a,b,c) (LINUX_VERSION_CODE + 1)
+ #endif
+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0)) \
+- || (__GLIBC__ < 2)
++ || (defined(__GLIBC__) && (__GLIBC__ < 2))
+ #define CANT_USE_SEND_RECV_MSG
+ #define DEF_SMTP_CACHE_DEMAND 0
+ #else
+--
+2.13.3
+
diff --git a/meta-openembedded/meta-networking/recipes-daemons/postfix/files/0001-makedefs-Use-native-compiler-to-build-makedefs.test.patch b/meta-openembedded/meta-networking/recipes-daemons/postfix/files/0001-makedefs-Use-native-compiler-to-build-makedefs.test.patch
new file mode 100644
index 000000000..763a4a9b9
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-daemons/postfix/files/0001-makedefs-Use-native-compiler-to-build-makedefs.test.patch
@@ -0,0 +1,64 @@
+From a0d0de10e4c5ab55bc2fa48798079e2876b1211d Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 26 Aug 2017 10:29:37 -0700
+Subject: [PATCH] makedefs: Use native compiler to build makedefs.test
+
+Its a binary used during build
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ makedefs | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/makedefs b/makedefs
+index 9fd4bc2..5ee7747 100644
+--- a/makedefs
++++ b/makedefs
+@@ -526,7 +526,7 @@ int main(int argc, char **argv)
+ exit(0);
+ }
+ EOF
+- ${CC-gcc} -o makedefs.test makedefs.test.c || exit 1
++ ${BUILD_CC-gcc} -o makedefs.test makedefs.test.c || exit 1
+ rm -f makedefs.test makedefs.test.[co]
+ fi;;
+ esac
+@@ -762,7 +762,7 @@ int main(int argc, char **argv)
+ exit(0);
+ }
+ EOF
+- ${CC-gcc} -o makedefs.test makedefs.test.c || exit 1
++ ${BUILD_CC-gcc} -o makedefs.test makedefs.test.c || exit 1
+ ./makedefs.test 2>/dev/null ||
+ CCARGS="$CCARGS -DNO_SIGSETJMP"
+ rm -f makedefs.test makedefs.test.[co]
+@@ -796,7 +796,7 @@ int main(int argc, char **argv)
+ &error) != 14);
+ }
+ EOF
+- ${CC-gcc} -o makedefs.test makedefs.test.c $icu_cppflags \
++ ${BUILD_CC-gcc} -o makedefs.test makedefs.test.c $icu_cppflags \
+ $icu_ldflags >/dev/null 2>&1
+ if ./makedefs.test 2>/dev/null ; then
+ CCARGS="$CCARGS $icu_cppflags"
+@@ -911,7 +911,7 @@ int main(void)
+ exit(ferror(stdout) ? 1 : 0);
+ }
+ EOF
+- eval ${CC-gcc} ${CCARGS} -o makedefs.test makedefs.test.c || exit 1
++ eval ${BUILD_CC-gcc} ${CCARGS} -o makedefs.test makedefs.test.c || exit 1
+ ./makedefs.test || exit 1
+ rm -f makedefs.test makedefs.test.[co]
+ }
+@@ -1067,7 +1067,7 @@ int main(void)
+ exit(ferror(stdout) ? 1 : 0);
+ }
+ EOF
+- eval ${CC-gcc} ${CCARGS} -o makedefs.test makedefs.test.c || exit 1
++ eval ${BUILD_CC-gcc} ${CCARGS} -o makedefs.test makedefs.test.c || exit 1
+ parm_val=`./makedefs.test` || exit 1
+ rm -f makedefs.test makedefs.test.[co]
+ eval ${parm_name}=\""\$parm_val"\"
+--
+2.14.1
+
diff --git a/meta-openembedded/meta-networking/recipes-daemons/postfix/files/aliasesdb b/meta-openembedded/meta-networking/recipes-daemons/postfix/files/aliasesdb
new file mode 100755
index 000000000..855a64f70
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-daemons/postfix/files/aliasesdb
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+ALIASESDB_STAMP=/var/lib/misc/postfix.aliasesdb-stamp
+
+make_aliasesdb() {
+ if [ "$(/usr/sbin/postconf -h alias_database)" = "hash:/etc/aliases" ]
+ then
+ # /etc/aliases.db may be used by other MTA, make sure nothing
+ # has touched it since our last newaliases call
+ [ /etc/aliases -nt /etc/aliases.db ] ||
+ [ "$ALIASESDB_STAMP" -nt /etc/aliases.db ] ||
+ [ "$ALIASESDB_STAMP" -ot /etc/aliases.db ] || return 0
+ /usr/bin/newaliases
+ touch -r /etc/aliases.db "$ALIASESDB_STAMP"
+ else
+ /usr/bin/newaliases
+ fi
+}
+
+make_aliasesdb
diff --git a/meta-openembedded/meta-networking/recipes-daemons/postfix/files/check_hostname.sh b/meta-openembedded/meta-networking/recipes-daemons/postfix/files/check_hostname.sh
new file mode 100755
index 000000000..37a0dd088
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-daemons/postfix/files/check_hostname.sh
@@ -0,0 +1,13 @@
+#! /bin/sh
+
+HOSTNAME=$(/bin/hostname)
+
+if [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" -o ! -z "`echo $HOSTNAME | sed -n '/^[0-9]*\.[0-9].*/p'`" ]; then
+ # If hostname is invalid, and myhostname not existed in main.cf
+ /usr/sbin/postconf -h "myhostname" 2>/dev/null
+ if [ $? -ne 0 ]; then
+ # Set "localhost" to main.cf
+ /usr/sbin/postconf -e "myhostname=localhost"
+ fi
+fi
+
diff --git a/meta-openembedded/meta-networking/recipes-daemons/postfix/files/icu-config.patch b/meta-openembedded/meta-networking/recipes-daemons/postfix/files/icu-config.patch
new file mode 100644
index 000000000..9bd9c2f03
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-daemons/postfix/files/icu-config.patch
@@ -0,0 +1,21 @@
+do not entertain cppflags from icu, this is because
+icu-config feeds the -I path without sysroot which
+caused native headers to be included and build is
+corrupted in any case its just adding -I/usr/include
+to the CCARGS which we loose nothing if its not
+entertained.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: postfix-3.2.2/makedefs
+===================================================================
+--- postfix-3.2.2.orig/makedefs
++++ postfix-3.2.2/makedefs
+@@ -799,7 +799,6 @@ EOF
+ ${BUILD_CC-gcc} -o makedefs.test makedefs.test.c $icu_cppflags \
+ $icu_ldflags >/dev/null 2>&1
+ if ./makedefs.test 2>/dev/null ; then
+- CCARGS="$CCARGS $icu_cppflags"
+ SYSLIBS="$SYSLIBS $icu_ldflags"
+ else
+ CCARGS="$CCARGS -DNO_EAI"
diff --git a/meta-openembedded/meta-networking/recipes-daemons/postfix/files/install.patch b/meta-openembedded/meta-networking/recipes-daemons/postfix/files/install.patch
new file mode 100644
index 000000000..d023680f3
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-daemons/postfix/files/install.patch
@@ -0,0 +1,93 @@
+From 190650e1cd5700cd6950ead3fcb17ebcec192a2e Mon Sep 17 00:00:00 2001
+From: Li xin <lixin.fnst@cn.fujitsu.com>
+Date: Fri, 19 Jun 2015 17:14:58 +0900
+Subject: [PATCH] Change fixed postconf to a variable for cross-compiling
+
+Upstreamstatus: Inappropriate [embedded specific]
+
+Signed-off-by: Yao Zhao <yao.zhao@windriver.com>
+---
+ postfix-install | 18 ++++++++++--------
+ 1 file changed, 10 insertions(+), 8 deletions(-)
+
+diff --git a/postfix-install b/postfix-install
+index 1662c3d..d11fa12 100644
+--- a/postfix-install
++++ b/postfix-install
+@@ -226,8 +226,8 @@ test -z "$non_interactive" -a ! -t 0 && {
+ exit 1
+ }
+
+-test -x bin/postconf || {
+- echo $0: Error: no bin/postconf file. Did you forget to run \"make\"? 1>&2
++test -x "$POSTCONF" || {
++ echo $0: Error: no $POSTCONF file. Did you forget to run \"make\"? 1>&2
+ exit 1
+ }
+
+@@ -248,7 +248,7 @@ do
+ case "$junk" in
+ *MAIL_VERSION*)
+ case "$mail_version" in
+- "") mail_version="`bin/postconf -dhx mail_version`" || exit 1
++ "") mail_version="`$POSTCONF -dhx mail_version`" || exit 1
+ esac
+ val=`echo "$junk" | sed 's/MAIL_VERSION$/'"$mail_version/g"` || exit 1
+ case "$val" in
+@@ -434,7 +434,7 @@ template files main.cf.proto and master.cf.proto."
+
+ : ${install_root=/}
+ : ${tempdir=`pwd`}
+-: ${config_directory=`bin/postconf -c conf -h -d config_directory`}
++: ${config_directory=`$POSTCONF -c conf -h -d config_directory`}
+
+ # Find out the location of installed configuration files.
+
+@@ -500,7 +500,7 @@ test -f $CONFIG_DIRECTORY/main.cf && {
+ case "$junk" in
+ "") eval unset $name;;
+ esac
+- eval : \${$name=\`bin/postconf -c $CONFIG_DIRECTORY -hx $name\`} ||
++ eval : \${$name=\`$POSTCONF -c $CONFIG_DIRECTORY -hx $name\`} ||
+ exit 1
+ done
+ }
+@@ -513,7 +513,7 @@ do
+ case "$junk" in
+ "") eval unset $name;;
+ esac
+- eval : \${$name=\`bin/postconf -c conf -d -hx $name\`} || exit 1
++ eval : \${$name=\`$POSTCONF -c conf -d -hx $name\`} || exit 1
+ done
+
+ # Override settings manually.
+@@ -639,6 +639,8 @@ README_DIRECTORY=$install_root$readme_directory
+ SHLIB_DIRECTORY=$install_root$shlib_directory
+ META_DIRECTORY=$install_root$meta_directory
+
++test "x$POSTCONF" != "x" || POSTCONF="bin/postconf"
++
+ # Avoid repeated tests for existence of these; default permissions suffice.
+
+ test -d $DAEMON_DIRECTORY || mkdir -p $DAEMON_DIRECTORY || exit 1
+@@ -810,7 +812,7 @@ IFS="$BACKUP_IFS"
+ # the wrong place when Postfix is being upgraded.
+
+ case "$mail_version" in
+-"") mail_version="`bin/postconf -dhx mail_version`" || exit 1
++"") mail_version="`$POSTCONF -dhx mail_version`" || exit 1
+ esac
+
+ # Undo MAIL_VERSION expansion at the end of a parameter value. If
+@@ -830,7 +832,7 @@ do
+ esac
+ done
+
+-bin/postconf -c $CONFIG_DIRECTORY -e \
++"$POSTCONF" -c $CONFIG_DIRECTORY -e \
+ "daemon_directory = $daemon_directory" \
+ "data_directory = $data_directory" \
+ "command_directory = $command_directory" \
+--
+1.8.4.2
+
diff --git a/meta-openembedded/meta-networking/recipes-daemons/postfix/files/internal_recipient b/meta-openembedded/meta-networking/recipes-daemons/postfix/files/internal_recipient
new file mode 100644
index 000000000..6a8f2681b
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-daemons/postfix/files/internal_recipient
@@ -0,0 +1 @@
+root@ permit_mynetworks,reject
diff --git a/meta-openembedded/meta-networking/recipes-daemons/postfix/files/main.cf b/meta-openembedded/meta-networking/recipes-daemons/postfix/files/main.cf
new file mode 100644
index 000000000..e75c6fc0d
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-daemons/postfix/files/main.cf
@@ -0,0 +1,105 @@
+compatibility_level = 2
+smtputf8_enable = no
+
+# Configure your domain and accounts
+#mydomain=sample.com
+#FQDN from gethostname
+#myhostname =
+mydomain=localdomain
+mydestination = $myhostname, localhost.localdomain localhost
+mynetworks = 127.0.0.1/8
+inet_interfaces = 127.0.0.1
+
+virtual_mailbox_domains = sample.com, other.net
+virtual_mailbox_maps = hash:/etc/postfix/virtual
+virtual_alias_maps = hash:/etc/postfix/virtual_alias
+
+alias_maps = hash:/etc/aliases
+
+# You'll start with the following lines for maildir storage
+virtual_mailbox_base = /var/spool/vmail
+virtual_uid_maps = static:`grep vmail /etc/passwd | cut -d ":" -f 3`
+virtual_gid_maps = static:`grep vmail /etc/passwd | cut -d ":" -f 4`
+
+
+# You'll start with the following lines for IMAP storage
+#virtual_transport = lmtp:unix:/var/lib/cyrus/socket/lmtp
+
+
+# General stuff here again
+#config_directory = /etc/postfix
+sample_directory = /etc/postfix
+queue_directory = /var/spool/postfix
+mail_spool_directory = /var/spool/mail
+readme_directory = no
+command_directory = /usr/sbin
+daemon_directory = @LIBEXECDIR@/postfix
+mail_owner = postfix
+setgid_group = postdrop
+unknown_local_recipient_reject_code = 450
+mynetworks_style = host
+debug_peer_level = 2
+sendmail_path = /usr/sbin/sendmail
+newaliases_path = /usr/bin/newaliases
+mailq_path = /usr/bin/mailq
+
+smtpd_data_restrictions =
+ permit_mynetworks,
+ reject_unauth_pipelining,
+ permit
+
+smtpd_client_restrictions =
+ permit_mynetworks,
+ # reject_unknown_client, # This can cause a lot of false rejects.
+ reject_invalid_hostname,
+ reject_rbl_client list.dsbl.org,
+ reject_rbl_client sbl.spamhaus.org,
+ reject_rbl_client cbl.abuseat.org,
+ reject_rbl_client dul.dnsbl.sorbs.net,
+ permit
+
+smtpd_helo_required = yes
+smtpd_helo_restrictions =
+ permit_mynetworks,
+ reject_unauth_pipelining,
+ # reject_non_fqdn_hostname, # This can cause a lot of false rejects.
+ # reject_unknown_hostname, # This can cause a lot of false rejects.
+ reject_invalid_hostname,
+ permit
+
+smtpd_sender_restrictions =
+ permit_mynetworks,
+ reject_non_fqdn_sender,
+ # check_sender_access hash:/etc/postfix/access_domains,
+ reject_unknown_sender_domain,
+ permit
+
+smtpd_recipient_restrictions =
+ permit_mynetworks,
+ permit_sasl_authenticated,
+ reject_unauth_destination,
+
+ # check_recipient_access pcre:/etc/postfix/recipient_checks.pcre,
+ # check_helo_access pcre:/etc/postfix/helo_checks.pcre,
+
+ # check_client_access hash:/etc/postfix/maps/access_client,
+ # check_client_access hash:/etc/postfix/maps/exceptions_client,
+ # check_helo_access hash:/etc/postfix/maps/access_helo,
+ # check_helo_access hash:/etc/postfix/maps/verify_helo,
+ # check_sender_access hash:/etc/postfix/maps/access_sender,
+ # check_sender_access hash:/etc/postfix/maps/verify_sender,
+ # check_recipient_access hash:/etc/postfix/maps/access_recipient,
+
+ # reject_multi_recipient_bounce,
+ reject_non_fqdn_recipient,
+ reject_unknown_recipient_domain,
+ # reject_unlisted_recipient,
+ #check_policy_service unix:private/policy,
+
+ # check_sender_access hash:/etc/postfix/maps/no_verify_sender,
+ # check_sender_access hash:/etc/postfix/access_domains,
+ # reject_unverified_sender,
+ # reject_unverified_recipient
+ check_recipient_access hash:/etc/postfix/internal_recipient
+
+disable_vrfy_command = yes
diff --git a/meta-openembedded/meta-networking/recipes-daemons/postfix/files/makedefs.patch b/meta-openembedded/meta-networking/recipes-daemons/postfix/files/makedefs.patch
new file mode 100644
index 000000000..98d5f7ed6
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-daemons/postfix/files/makedefs.patch
@@ -0,0 +1,116 @@
+From 4f49e2ce420fb3c17415937530493158ef312733 Mon Sep 17 00:00:00 2001
+From: Li xin <lixin.fnst@cn.fujitsu.com>
+Date: Fri, 19 Jun 2015 16:45:54 +0900
+Subject: [PATCH] 1)remove RANLIB, SYSLIBS, AR and get them from env.
+
+2)reference sysroot when searching header files
+3)include sysroot path instead of absolute include path
+for Linux2 and Linux3 systems.
+4)for non-native build, search STAGING_BASELIBDIR/LIBDIR
+ native build, search host library path for nsl and resolv library
+ which comes from libc
+
+Upstreamstatus: Inappropriate [embedded specific]
+
+Signed-off-by: Yao Zhao <yao.zhao@windriver.com>
+---
+ makedefs | 27 +++++++++++----------------
+ 1 file changed, 11 insertions(+), 16 deletions(-)
+
+diff --git a/makedefs b/makedefs
+index 8b84e47..893fb0d 100644
+--- a/makedefs
++++ b/makedefs
+@@ -170,9 +170,6 @@ echo "# pie=$pie"
+
+ # Defaults for most sane systems
+
+-RANLIB=ranlib
+-SYSLIBS=
+-AR=ar
+ ARFL=rv
+
+ # Ugly function to make our error message more visible among the
+@@ -424,12 +421,12 @@ case "$SYSTEM.$RELEASE" in
+ case "$CCARGS" in
+ *-DNO_DB*) ;;
+ *-DHAS_DB*) ;;
+- *) if [ -f /usr/include/db.h ]
++ *) if [ -f "$BUILD_SYSROOT"/usr/include/db.h ]
+ then
+ : we are all set
+- elif [ -f /usr/include/db/db.h ]
++ elif [ -f "$BUILD_SYSROOT"/usr/include/db/db.h ]
+ then
+- CCARGS="$CCARGS -I/usr/include/db"
++ CCARGS="$CCARGS -I"$BUILD_SYSROOT"/usr/include/db"
+ else
+ # No, we're not going to try db1 db2 db3 etc.
+ # On a properly installed system, Postfix builds
+@@ -438,12 +435,12 @@ case "$SYSTEM.$RELEASE" in
+ echo "Install the appropriate db*-devel package first." 1>&2
+ exit 1
+ fi
+- SYSLIBS="-ldb"
++ SYSLIBS="$SYSLIBS -ldb"
+ ;;
+ esac
+ for name in nsl resolv $GDBM_LIBS
+ do
+- for lib in /usr/lib64 /lib64 /usr/lib /lib
++ for lib in $BUILD_SYSROOT_NSL_PATH
+ do
+ test -e $lib/lib$name.a -o -e $lib/lib$name.so && {
+ SYSLIBS="$SYSLIBS -l$name"
+@@ -463,7 +460,7 @@ case "$SYSTEM.$RELEASE" in
+ if [ `expr "X$CCARGS" : "X.*-DNO_EPOLL"` -gt 0 ]
+ then
+ :
+- elif [ ! -e /usr/include/sys/epoll.h ]
++ elif [ ! -e "$BUILD_SYSROOT"/usr/include/sys/epoll.h ]
+ then
+ echo CCARGS="$CCARGS -DNO_EPOLL"
+ else
+@@ -487,8 +484,6 @@ int main(int argc, char **argv)
+ }
+ EOF
+ ${CC-gcc} -o makedefs.test makedefs.test.c || exit 1
+- ./makedefs.test 2>/dev/null ||
+- CCARGS="$CCARGS -DNO_EPOLL"
+ rm -f makedefs.test makedefs.test.[co]
+ fi;;
+ esac
+@@ -504,12 +499,12 @@ EOF
+ case "$CCARGS" in
+ *-DNO_DB*) ;;
+ *-DHAS_DB*) ;;
+- *) if [ -f /usr/include/db.h ]
++ *) if [ -f "$BUILD_SYSROOT"/usr/include/db.h ]
+ then
+ : we are all set
+- elif [ -f /usr/include/db/db.h ]
++ elif [ -f "$BUILD_SYSROOT"/usr/include/db/db.h ]
+ then
+- CCARGS="$CCARGS -I/usr/include/db"
++ CCARGS="$CCARGS -I"$BUILD_SYSROOT"/usr/include/db"
+ else
+ # On a properly installed system, Postfix builds
+ # by including <db.h> and by linking with -ldb
+@@ -517,12 +512,12 @@ EOF
+ echo "Install the appropriate db*-devel package first." 1>&2
+ exit 1
+ fi
+- SYSLIBS="-ldb"
++ SYSLIBS="$SYSLIBS -ldb"
+ ;;
+ esac
+ for name in nsl resolv
+ do
+- for lib in /usr/lib64 /lib64 /usr/lib /usr/lib/* /lib /lib/*
++ for lib in $BUILD_SYSROOT_NSL_PATH
+ do
+ test -e $lib/lib$name.a -o -e $lib/lib$name.so && {
+ SYSLIBS="$SYSLIBS -l$name"
+--
+1.8.4.2
+
diff --git a/meta-openembedded/meta-networking/recipes-daemons/postfix/files/postfix b/meta-openembedded/meta-networking/recipes-daemons/postfix/files/postfix
new file mode 100755
index 000000000..8c7a60175
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-daemons/postfix/files/postfix
@@ -0,0 +1,94 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: postfix MTA
+# Default-Start: 2345
+# Default-Stop: 016
+# Short-Description: start and stop postfix
+# Description: Postfix is a Mail Transport Agent, which is the program
+# that moves mail from one machine to another.
+### END INIT INFO
+
+success() {
+ echo " Successful"
+ exit 0
+}
+
+fail() {
+ echo " Failed"
+ exit 1
+
+}
+
+check_return () {
+ local ret="$1"
+
+ if [ "$ret" = "0" ]; then
+ success
+ else
+ fail
+ fi
+}
+
+PIDFile=/var/spool/postfix/pid/master.pid
+case "$1" in
+
+ start)
+ echo -n "Starting Postfix..."
+ if [ ! -e /etc/aliases.db ]; then
+ # The alias database is necessary for postfix to work correctly.
+ echo "Creating aliases database ..."
+ newaliases
+ fi
+ if ! postfix status >/dev/null 2>&1; then
+ /usr/sbin/check_hostname.sh
+ postfix start
+ check_return $?
+ else
+ success
+ fi
+ ;;
+
+ stop)
+ echo -n "Stopping Postfix..."
+ if postfix status >/dev/null 2>&1; then
+ postfix stop
+ check_return $?
+ else
+ success
+ fi
+ ;;
+
+ reload)
+ echo -n "Reloading Postfix..."
+ if postfix status >/dev/null 2>&1; then
+ postfix reload
+ check_return $?
+ else
+ postfix start
+ check_return $?
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+
+ status)
+ if postfix status >/dev/null 2>&1; then
+ pid=`sed -e 's/\s//g' $PIDFile`
+ echo "The Postfix mail system is running (PID: $pid)"
+ exit 0
+ else
+ echo "The Postfix mail system is not running"
+ exit 1
+ fi
+ ;;
+
+ *)
+ echo "Usage: $0 {start|stop|status|reload|restart}"
+ exit 1
+ ;;
+esac
+
diff --git a/meta-openembedded/meta-networking/recipes-daemons/postfix/files/postfix-install.patch b/meta-openembedded/meta-networking/recipes-daemons/postfix/files/postfix-install.patch
new file mode 100644
index 000000000..45479bd52
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-daemons/postfix/files/postfix-install.patch
@@ -0,0 +1,26 @@
+Index: postfix-3.2.2/postfix-install
+===================================================================
+--- postfix-3.2.2.orig/postfix-install
++++ postfix-3.2.2/postfix-install
+@@ -843,7 +843,7 @@ IFS="$BACKUP_IFS"
+ # the wrong place when Postfix is being upgraded.
+
+ case "$mail_version" in
+-"") mail_version="`$POSTCONF -dhx mail_version`" || exit 1
++"") mail_version="`$POSTCONF -c $CONFIG_DIRECTORY -dhx mail_version`" || exit 1
+ esac
+
+ # Undo MAIL_VERSION expansion at the end of a parameter value. If
+Index: postfix-3.2.2/Makefile.in
+===================================================================
+--- postfix-3.2.2.orig/Makefile.in
++++ postfix-3.2.2/Makefile.in
+@@ -20,7 +20,7 @@ META = meta/main.cf.proto meta/master.cf
+ EXPAND = sed -e "s;\$${LIB_PREFIX};$(LIB_PREFIX);" \
+ -e "s;\$${LIB_SUFFIX};$(LIB_SUFFIX);"
+ SHLIB_DIR_OVERRIDE = \
+- $${shlib_directory:-`$(SHLIB_ENV) bin/postconf -dhx shlib_directory`}
++ $${shlib_directory:-`$(SHLIB_ENV) $(POSTCONF) -dhx shlib_directory`}
+
+ default: update
+
diff --git a/meta-openembedded/meta-networking/recipes-daemons/postfix/files/postfix.service b/meta-openembedded/meta-networking/recipes-daemons/postfix/files/postfix.service
new file mode 100644
index 000000000..30d54a440
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-daemons/postfix/files/postfix.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=Postfix Mail Transport Agent
+After=syslog.target network.target
+Conflicts=sendmail.service exim.service
+
+[Service]
+Type=forking
+PIDFile=@LOCALSTATEDIR@/spool/postfix/pid/master.pid
+ExecStartPre=-@SBINDIR@/check_hostname.sh
+ExecStartPre=-@LIBEXECDIR@/postfix/aliasesdb
+ExecStart=@SBINDIR@/postfix start
+ExecReload=@SBINDIR@/postfix reload
+ExecStop=@SBINDIR@/postfix stop
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-openembedded/meta-networking/recipes-daemons/postfix/postfix.inc b/meta-openembedded/meta-networking/recipes-daemons/postfix/postfix.inc
new file mode 100644
index 000000000..09447d50a
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-daemons/postfix/postfix.inc
@@ -0,0 +1,262 @@
+SUMMARY = "Postfix Mail Transport Agent"
+DESCRIPTION = "Postfix is Wietse Venema's mail server that started life at \
+IBM research as an alternative to the widely-used Sendmail program. \
+Postfix attempts to be fast, easy to administer, and secure. The outsidei \
+has a definite Sendmail-ish flavor, but the inside is completely different."
+
+HOMEPAGE= "http://www.postfix.org"
+SECTION = "mail"
+DEPENDS = "db icu libpcre openssl postfix-native \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'ldap', 'openldap', '', d)} \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'sasl', 'cyrus-sasl', '', d)} \
+"
+DEPENDS_class-native = "db-native icu-native openssl-native libpcre-native"
+
+LICENSE = "IPL-1.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=64375f37431336ea1b1b3005fe3fa354"
+
+SRC_URI = "ftp://ftp.porcupine.org/mirrors/postfix-release/official/postfix-${PV}.tar.gz \
+ file://makedefs.patch \
+ file://install.patch \
+ file://main.cf \
+ file://postfix \
+ file://internal_recipient \
+ file://postfix.service \
+ file://aliasesdb \
+ file://check_hostname.sh \
+"
+
+S = "${WORKDIR}/postfix-${PV}"
+
+CLEANBROKEN = "1"
+
+BBCLASSEXTEND = "native"
+
+inherit update-rc.d useradd update-alternatives systemd
+
+INITSCRIPT_NAME = "postfix"
+INITSCRIPT_PARAMS = "start 58 3 4 5 . stop 13 0 1 6 ."
+USERADD_PACKAGES = "${PN}"
+USERADD_PARAM_${PN} = \
+"-d /var/spool/postfix -r -g postfix --shell /bin/false postfix; \
+ -d /var/spool/vmail -r -g vmail --shell /bin/false vmail \
+"
+GROUPADD_PARAM_${PN} = "--system postfix;--system postdrop;--system vmail"
+
+export SYSLIBS = "${LDFLAGS}"
+
+# CCARGS specifies includes, defines
+# AUXLIBS specifies libraries
+# Linux2/Linux3 has HAS_DB defined
+# makedefs will make CC to be CC+CCARGS
+
+# ldap support
+export CCARGS-ldap = "\
+ ${@bb.utils.contains('DISTRO_FEATURES', 'ldap', '-DHAS_LDAP', '', d)}"
+export AUXLIBS-ldap = "\
+ ${@bb.utils.contains('DISTRO_FEATURES', 'ldap', '-lldap -llber', '', d)}"
+
+# no native openldap
+export CCARGS-ldap_class-native = ""
+export AUXLIBS-ldap_class-native = ""
+
+export CCARGS-nonis_libc-musl = "-DNO_NIS"
+export CCARGS-nonis = ""
+
+# SASL support -DUSE_LDAP_SASL -DUSE_SASL_AUTH
+# current openldap didn't enable SASL
+export CCARGS-sasl = "\
+ ${@bb.utils.contains('DISTRO_FEATURES', 'sasl', '-DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I${STAGING_INCDIR}/sasl', '', d)}"
+export AUXLIBS-sasl = "\
+ ${@bb.utils.contains('DISTRO_FEATURES', 'sasl', '-lsasl2', '', d)}"
+export CCARGS-sasl_class-native = ""
+export AUXLIBS-sasl_class-native = ""
+
+# PCRE, TLS support default
+export CCARGS = "${CFLAGS} -DHAS_PCRE -DUSE_TLS -I${STAGING_INCDIR}/openssl ${CCARGS-ldap} ${CCARGS-sasl} ${CCARGS-nonis}"
+export AUXLIBS = "-lpcre -lssl -lcrypto ${AUXLIBS-sasl} ${AUXLIBS-ldap}"
+export POSTCONF = "${STAGING_DIR_NATIVE}${sbindir_native}/postconf"
+
+export CCARGS-nonis_libc-musl = "-DNO_NIS"
+# OPT,DEBUG is aready in CFLAGS
+# ignore the OPTS="CC=$CC" in Makefile it will not use the CC=$CC $CCARGS
+EXTRA_OEMAKE += "OPT= DEBUG= OPTS= "
+
+do_compile () {
+ unset CFLAGS CPPFLAGS CXXFLAGS
+ local native_build
+
+ native_build="${@['0', '1'][bb.data.inherits_class('native', d) or bb.data.inherits_class('nativesdk', d)]}"
+
+ # if not native build, then pass SYSTEM and RELEASE to makedefs
+ if [ "${native_build}" != "1" ]; then
+ # uname -s for target
+ SYSTEM="Linux"
+
+ # uname -r, use 2.6 as bottomline, even target kernel ver > 2.6
+ RELEASE="2.6.34"
+ sed -i -e \
+ "s:\$(SHELL) makedefs):\$(SHELL) makedefs $SYSTEM $RELEASE):" \
+ ${S}/Makefile.in
+ export BUILD_SYSROOT="${STAGING_DIR_HOST}"
+ export BUILD_SYSROOT_NSL_PATH="${STAGING_BASELIBDIR} \
+ ${STAGING_LIBDIR}"
+ else
+ # native build
+ export BUILD_SYSROOT="${STAGING_DIR_NATIVE}"
+
+ # ubuntu x86 host: /lib/x86_64-linux-gnu(64) /lib/i386-linux-gnu (32)
+ # on 64 bits, 32 libs in i386-linux-gnu
+ # let makedefs finds nsl and resolv libs, host CC will link
+ # the correct libraries
+ BUILD_SYSROOT_NSL_PATH="$(${CC} -print-search-dirs 2>/dev/null | \
+ sed -n '/^libraries: =/s/libraries: =//p' | \
+ sed -e 's/:/\n/g' | xargs -n1 readlink -f | \
+ grep -v 'gcc\|/[0-9.]\+$' | sort -u)"
+ if [ -z "$BUILD_SYSROOT_NSL_PATH" ]; then
+ BUILD_SYSROOT_NSL_PATH="/usr/lib64 /lib64 \
+ /lib/x86_64-linux-gnu \
+ /usr/lib /lib \
+ /lib/i386-linux-gnu"
+ fi
+ export BUILD_SYSROOT_NSL_PATH
+ fi
+
+ oe_runmake makefiles
+ oe_runmake
+}
+
+do_install_prepend_class-native() {
+ export POSTCONF="bin/postconf"
+}
+
+SYSTEMD_SERVICE_${PN} = "postfix.service"
+
+do_install () {
+ sh ./postfix-install 'install_root=${D}' \
+ 'config_directory=${sysconfdir}/postfix' \
+ 'daemon_directory=${libexecdir}/postfix' \
+ 'command_directory=${sbindir}' \
+ 'queue_directory=${localstatedir}/spool/postfix' \
+ 'sendmail_path=${sbindir}/sendmail.postfix' \
+ 'newaliases_path=${bindir}/newaliases' \
+ 'mailq_path=${bindir}/mailq' \
+ 'manpage_directory=${mandir}' \
+ 'readme_directory=${datadir}/doc/postfix' \
+ 'data_directory=${localstatedir}/lib/postfix' \
+ -non-interactive
+ rm -rf ${D}${localstatedir}/spool/postfix
+ mv ${D}${sysconfdir}/postfix/main.cf ${D}${sysconfdir}/postfix/sample-main.cf
+ install -m 755 ${S}/bin/smtp-sink ${D}/${sbindir}/
+ install -d ${D}${sysconfdir}/init.d
+ install -m 644 ${WORKDIR}/main.cf ${D}${sysconfdir}/postfix/main.cf
+ sed -i 's#@LIBEXECDIR@#${libexecdir}#' ${D}${sysconfdir}/postfix/main.cf
+
+ install -m 755 ${WORKDIR}/check_hostname.sh ${D}${sbindir}/
+
+ install -m 755 ${WORKDIR}/postfix ${D}${sysconfdir}/init.d/postfix
+ install -m 644 ${WORKDIR}/internal_recipient ${D}${sysconfdir}/postfix/internal_recipient
+
+ install -d ${D}${systemd_unitdir}/system
+ install -m 0644 ${WORKDIR}/postfix.service ${D}${systemd_unitdir}/system
+ sed -i -e 's#@LIBEXECDIR@#${libexecdir}#g' ${D}${systemd_unitdir}/system/postfix.service
+ sed -i -e 's#@LOCALSTATEDIR@#${localstatedir}#g' ${D}${systemd_unitdir}/system/postfix.service
+ sed -i -e 's#@SBINDIR@#${sbindir}#g' ${D}${systemd_unitdir}/system/postfix.service
+
+ install -m 0755 ${WORKDIR}/aliasesdb ${D}${libexecdir}/postfix
+
+ install -m 770 -d ${D}${localstatedir}/spool/postfix
+ chown postfix:postfix ${D}${localstatedir}/spool/postfix
+
+ install -m 0755 -d ${D}${localstatedir}/lib/postfix
+ chown postfix:nogroup ${D}${localstatedir}/lib/postfix
+ install -m 0755 -d ${D}${localstatedir}/spool/postfix
+ chown root:postfix ${D}${localstatedir}/spool/postfix
+ install -m 0700 -d ${D}${localstatedir}/spool/postfix/active
+ chown postfix:root ${D}${localstatedir}/spool/postfix/active
+ install -m 0700 -d ${D}${localstatedir}/spool/postfix/bounce
+ chown postfix:root ${D}${localstatedir}/spool/postfix/bounce
+ install -m 0700 -d ${D}${localstatedir}/spool/postfix/corrupt
+ chown postfix:root ${D}${localstatedir}/spool/postfix/corrupt
+ install -m 0700 -d ${D}${localstatedir}/spool/postfix/defer
+ chown postfix:root ${D}${localstatedir}/spool/postfix/defer
+ install -m 0700 -d ${D}${localstatedir}/spool/postfix/deferred
+ chown postfix:root ${D}${localstatedir}/spool/postfix/deferred
+ install -m 0700 -d ${D}${localstatedir}/spool/postfix/flush
+ chown postfix:root ${D}${localstatedir}/spool/postfix/flush
+ install -m 0700 -d ${D}${localstatedir}/spool/postfix/hold
+ chown postfix:root ${D}${localstatedir}/spool/postfix/hold
+ install -m 0700 -d ${D}${localstatedir}/spool/postfix/incoming
+ chown postfix:root ${D}${localstatedir}/spool/postfix/incoming
+ install -m 0700 -d ${D}${localstatedir}/spool/postfix/saved
+ chown postfix:root ${D}${localstatedir}/spool/postfix/saved
+ install -m 0700 -d ${D}${localstatedir}/spool/postfix/trace
+ chown postfix:root ${D}${localstatedir}/spool/postfix/trace
+ install -m 0730 -d ${D}${localstatedir}/spool/postfix/maildrop
+ chown postfix:postdrop ${D}${localstatedir}/spool/postfix/maildrop
+ install -m 0755 -d ${D}${localstatedir}/spool/postfix/pid
+ chown root:root ${D}${localstatedir}/spool/postfix/pid
+ install -m 0700 -d ${D}${localstatedir}/spool/postfix/private
+ chown postfix:root ${D}${localstatedir}/spool/postfix/private
+ install -m 0710 -d ${D}${localstatedir}/spool/postfix/public
+ chown postfix:postdrop ${D}${localstatedir}/spool/postfix/public
+ install -m 0755 -d ${D}${localstatedir}/spool/vmail
+ chown vmail:vmail ${D}${localstatedir}/spool/vmail
+
+ chown :postdrop ${D}${sbindir}/postqueue
+ chown :postdrop ${D}${sbindir}/postdrop
+ chmod g+s ${D}${sbindir}/postqueue
+ chmod g+s ${D}${sbindir}/postdrop
+}
+
+do_install_append_class-native() {
+ ln -sf ../sbin/sendmail.postfix ${D}${bindir}/newaliases
+ ln -sf ../sbin/sendmail.postfix ${D}${bindir}/mailq
+}
+
+do_install_append_class-target() {
+ # Remove references to buildmachine paths in target makedefs.out
+ sed -i 's:-fdebug-prefix-map[^ ]*::g; s:--sysroot=${STAGING_DIR_TARGET}::g' ${D}/etc/postfix/makedefs.out
+}
+
+ALTERNATIVE_${PN} = "sendmail"
+ALTERNATIVE_TARGET[sendmail] = "${sbindir}/sendmail.postfix"
+ALTERNATIVE_LINK_NAME[sendmail] = "${sbindir}/sendmail"
+ALTERNATIVE_PRIORITY = "120"
+
+ALTERNATIVE_${PN}-doc += "mailq.1 newaliases.1 sendmail.1"
+ALTERNATIVE_LINK_NAME[mailq.1] = "${mandir}/man1/mailq.1"
+ALTERNATIVE_LINK_NAME[newaliases.1] = "${mandir}/man1/newaliases.1"
+ALTERNATIVE_LINK_NAME[sendmail.1] = "${mandir}/man1/sendmail.1"
+
+PACKAGE_WRITE_DEPS += "postfix-native"
+pkg_postinst_${PN} () {
+ if [ "x$D" = "x" ]; then
+ touch /etc/aliases
+ newaliases
+
+ # generate virtual_alias, default is hash
+ touch /etc/postfix/virtual_alias
+ postmap /etc/postfix/virtual_alias
+ else
+ if ${@'true' if 'linuxstdbase' in d.getVar('DISTROOVERRIDES', False) else 'false'}; then
+ # /usr/lib/sendmail is required by LSB core test
+ [ ! -L $D/usr/lib/sendmail ] && ln -sf ${sbindir}/sendmail $D/usr/lib/
+ fi
+
+ touch $D/etc/aliases
+ # This can fail depending on host setup
+ if ! newaliases -C $D/etc/postfix/main.cf -oA$D/etc/aliases; then
+ $INTERCEPT_DIR/postinst_intercept delay_to_first_boot ${PKG} mlprefix=${MLPREFIX}
+ exit 0
+ fi
+ touch $D/etc/postfix/virtual_alias
+ postmap -c $D/etc/postfix $D/etc/postfix/virtual_alias
+
+ fi
+}
+
+# Exclude .debug directories from the main package
+FILES_${PN} = "${sysconfdir} ${localstatedir} ${bindir}/* ${sbindir}/* \
+ ${libexecdir}/* ${systemd_unitdir}/*"
+FILES_${PN}-dbg += "${libexecdir}/postfix/.debug"
diff --git a/meta-openembedded/meta-networking/recipes-daemons/postfix/postfix_3.2.2.bb b/meta-openembedded/meta-networking/recipes-daemons/postfix/postfix_3.2.2.bb
new file mode 100644
index 000000000..89af406ac
--- /dev/null
+++ b/meta-openembedded/meta-networking/recipes-daemons/postfix/postfix_3.2.2.bb
@@ -0,0 +1,9 @@
+require postfix.inc
+
+SRC_URI += "file://0001-Check-for-glibc-before-setting-CANT_USE_SEND_RECV_MS.patch \
+ file://0001-makedefs-Use-native-compiler-to-build-makedefs.test.patch \
+ file://postfix-install.patch \
+ file://icu-config.patch \
+ "
+SRC_URI[md5sum] = "aea073a9b0bea5bdb590460a270a4aa0"
+SRC_URI[sha256sum] = "d06849418d119d09366997b2b481bb23f737629769b4e4a52da42fb3ad8b0576"
OpenPOWER on IntegriCloud