summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-networking/recipes-daemons/postfix/files/install.patch66
-rw-r--r--meta-networking/recipes-daemons/postfix/files/internal_recipient1
-rw-r--r--meta-networking/recipes-daemons/postfix/files/main.cf_2.0102
-rw-r--r--meta-networking/recipes-daemons/postfix/files/makedefs.patch116
-rwxr-xr-xmeta-networking/recipes-daemons/postfix/files/postfix85
-rw-r--r--meta-networking/recipes-daemons/postfix/files/postfix-add-db6-support.patch26
-rw-r--r--meta-networking/recipes-daemons/postfix/files/postfix.service14
-rw-r--r--meta-networking/recipes-daemons/postfix/postfix.inc230
-rw-r--r--meta-networking/recipes-daemons/postfix/postfix_2.11.1.bb6
9 files changed, 646 insertions, 0 deletions
diff --git a/meta-networking/recipes-daemons/postfix/files/install.patch b/meta-networking/recipes-daemons/postfix/files/install.patch
new file mode 100644
index 000000000..a3fe089c2
--- /dev/null
+++ b/meta-networking/recipes-daemons/postfix/files/install.patch
@@ -0,0 +1,66 @@
1Change fixed postconf to a variable for cross-compiling
2
3Upstreamstatus: Inappropriate [embedded specific]
4
5Signed-off-by: Yao Zhao <yao.zhao@windriver.com>
6---
7diff --git a/postfix-install b/postfix-install
8index 49225ac..2e4c292 100644
9--- a/postfix-install
10+++ b/postfix-install
11@@ -201,8 +201,8 @@ test -z "$non_interactive" -a ! -t 0 && {
12 exit 1
13 }
14
15-test -x bin/postconf || {
16- echo $0: Error: no bin/postconf file. Did you forget to run \"make\"? 1>&2
17+test -x "$POSTCONF" || {
18+ echo $0: Error: no $POSTCONF file. Did you forget to run \"make\"? 1>&2
19 exit 1
20 }
21
22@@ -363,7 +363,7 @@ HTML files. Specify \"no\" if you do not want to install these files."
23
24 : ${install_root=/}
25 : ${tempdir=`pwd`}
26-: ${config_directory=`bin/postconf -c conf -h -d config_directory`}
27+: ${config_directory=`$POSTCONF -c conf -h -d config_directory`}
28
29 # Find out the location of installed configuration files.
30
31@@ -433,7 +433,7 @@ test -f $CONFIG_DIRECTORY/main.cf && {
32 case "$junk" in
33 "") eval unset $name;;
34 esac
35- eval : \${$name=\`bin/postconf -c $CONFIG_DIRECTORY -h $name\`} ||
36+ eval : \${$name=\`$POSTCONF -c $CONFIG_DIRECTORY -h $name\`} ||
37 exit 1
38 done
39 }
40@@ -446,7 +446,7 @@ do
41 case "$junk" in
42 "") eval unset $name;;
43 esac
44- eval : \${$name=\`bin/postconf -c conf -d -h $name\`} || exit 1
45+ eval : \${$name=\`$POSTCONF -c conf -d -h $name\`} || exit 1
46 done
47
48 # Override settings manually.
49@@ -565,6 +565,8 @@ HTML_DIRECTORY=$install_root$html_directory
50 MANPAGE_DIRECTORY=$install_root$manpage_directory
51 README_DIRECTORY=$install_root$readme_directory
52
53+test "x$POSTCONF" != "x" || POSTCONF="bin/postconf"
54+
55 # Avoid repeated tests for existence of these; default permissions suffice.
56
57 test -d $DAEMON_DIRECTORY || mkdir -p $DAEMON_DIRECTORY || exit 1
58@@ -724,7 +726,7 @@ do
59 # Postfix releases, and software should not suddenly be installed in
60 # the wrong place when Postfix is being upgraded.
61
62-bin/postconf -c $CONFIG_DIRECTORY -e \
63+"$POSTCONF" -c $CONFIG_DIRECTORY -e \
64 "daemon_directory = $daemon_directory" \
65 "data_directory = $data_directory" \
66 "command_directory = $command_directory" \
diff --git a/meta-networking/recipes-daemons/postfix/files/internal_recipient b/meta-networking/recipes-daemons/postfix/files/internal_recipient
new file mode 100644
index 000000000..6a8f2681b
--- /dev/null
+++ b/meta-networking/recipes-daemons/postfix/files/internal_recipient
@@ -0,0 +1 @@
root@ permit_mynetworks,reject
diff --git a/meta-networking/recipes-daemons/postfix/files/main.cf_2.0 b/meta-networking/recipes-daemons/postfix/files/main.cf_2.0
new file mode 100644
index 000000000..a128faa0a
--- /dev/null
+++ b/meta-networking/recipes-daemons/postfix/files/main.cf_2.0
@@ -0,0 +1,102 @@
1# Configure your domain and accounts
2#mydomain=sample.com
3#FQDN from gethostname
4#myhostname =
5mydomain=localdomain
6mydestination = $myhostname, localhost.localdomain localhost
7mynetworks = 127.0.0.1/8
8inet_interfaces = 127.0.0.1
9
10virtual_mailbox_domains = sample.com, other.net
11virtual_mailbox_maps = hash:/etc/postfix/virtual
12virtual_alias_maps = hash:/etc/postfix/virtual_alias
13
14alias_maps = hash:/etc/aliases
15
16# You'll start with the following lines for maildir storage
17virtual_mailbox_base = /var/spool/vmail
18virtual_uid_maps = static:`grep vmail /etc/passwd | cut -d ":" -f 3`
19virtual_gid_maps = static:`grep vmail /etc/passwd | cut -d ":" -f 4`
20
21
22# You'll start with the following lines for IMAP storage
23#virtual_transport = lmtp:unix:/var/lib/cyrus/socket/lmtp
24
25
26# General stuff here again
27config_directory = /etc/postfix
28sample_directory = /etc/postfix
29queue_directory = /var/spool/postfix
30mail_spool_directory = /var/spool/mail
31readme_directory = no
32command_directory = /usr/sbin
33daemon_directory = /usr/libexec/postfix
34mail_owner = postfix
35setgid_group = postdrop
36unknown_local_recipient_reject_code = 450
37mynetworks_style = host
38debug_peer_level = 2
39sendmail_path = /usr/sbin/sendmail
40newaliases_path = /usr/bin/newaliases
41mailq_path = /usr/bin/mailq
42
43smtpd_data_restrictions =
44 permit_mynetworks,
45 reject_unauth_pipelining,
46 permit
47
48smtpd_client_restrictions =
49 permit_mynetworks,
50 # reject_unknown_client, # This can cause a lot of false rejects.
51 reject_invalid_hostname,
52 reject_rbl_client list.dsbl.org,
53 reject_rbl_client sbl.spamhaus.org,
54 reject_rbl_client cbl.abuseat.org,
55 reject_rbl_client dul.dnsbl.sorbs.net,
56 permit
57
58smtpd_helo_required = yes
59smtpd_helo_restrictions =
60 permit_mynetworks,
61 reject_unauth_pipelining,
62 # reject_non_fqdn_hostname, # This can cause a lot of false rejects.
63 # reject_unknown_hostname, # This can cause a lot of false rejects.
64 reject_invalid_hostname,
65 permit
66
67smtpd_sender_restrictions =
68 permit_mynetworks,
69 reject_non_fqdn_sender,
70 # check_sender_access hash:/etc/postfix/access_domains,
71 reject_unknown_sender_domain,
72 permit
73
74smtpd_recipient_restrictions =
75 permit_mynetworks,
76 permit_sasl_authenticated,
77 reject_unauth_destination,
78
79 # check_recipient_access pcre:/etc/postfix/recipient_checks.pcre,
80 # check_helo_access pcre:/etc/postfix/helo_checks.pcre,
81
82 # check_client_access hash:/etc/postfix/maps/access_client,
83 # check_client_access hash:/etc/postfix/maps/exceptions_client,
84 # check_helo_access hash:/etc/postfix/maps/access_helo,
85 # check_helo_access hash:/etc/postfix/maps/verify_helo,
86 # check_sender_access hash:/etc/postfix/maps/access_sender,
87 # check_sender_access hash:/etc/postfix/maps/verify_sender,
88 # check_recipient_access hash:/etc/postfix/maps/access_recipient,
89
90 # reject_multi_recipient_bounce,
91 reject_non_fqdn_recipient,
92 reject_unknown_recipient_domain,
93 # reject_unlisted_recipient,
94 #check_policy_service unix:private/policy,
95
96 # check_sender_access hash:/etc/postfix/maps/no_verify_sender,
97 # check_sender_access hash:/etc/postfix/access_domains,
98 # reject_unverified_sender,
99 # reject_unverified_recipient
100 check_recipient_access hash:/etc/postfix/internal_recipient
101
102disable_vrfy_command = yes
diff --git a/meta-networking/recipes-daemons/postfix/files/makedefs.patch b/meta-networking/recipes-daemons/postfix/files/makedefs.patch
new file mode 100644
index 000000000..32c31b024
--- /dev/null
+++ b/meta-networking/recipes-daemons/postfix/files/makedefs.patch
@@ -0,0 +1,116 @@
11)remove RANLIB, SYSLIBS, AR and get them from env.
2
32)reference sysroot when searching header files
43)include sysroot path instead of absolute include path
5for Linux2 and Linux3 systems.
64)for non-native build, search STAGING_BASELIBDIR/LIBDIR
7 native build, search host library path for nsl and resolv library
8 which comes from libc
9
10Upstreamstatus: Inappropriate [embedded specific]
11
12Signed-off-by: Yao Zhao <yao.zhao@windriver.com>
13---
14 makedefs | 27 +++++++++++----------------
15 1 files changed, 11 insertions(+), 16 deletions(-)
16
17diff --git a/makedefs b/makedefs
18index dd5f256..e6fb795 100644
19--- a/makedefs
20+++ b/makedefs
21@@ -87,9 +87,6 @@
22
23 # Defaults for most sane systems
24
25-RANLIB=ranlib
26-SYSLIBS=
27-AR=ar
28 ARFL=rv
29
30 # Ugly function to make our error message more visible among the
31@@ -293,12 +290,12 @@ case "$SYSTEM.$RELEASE" in
32 case "$CCARGS" in
33 *-DNO_DB*) ;;
34 *-DHAS_DB*) ;;
35- *) if [ -f /usr/include/db.h ]
36+ *) if [ -f "$BUILD_SYSROOT"/usr/include/db.h ]
37 then
38 : we are all set
39- elif [ -f /usr/include/db/db.h ]
40+ elif [ -f "$BUILD_SYSROOT"/usr/include/db/db.h ]
41 then
42- CCARGS="$CCARGS -I/usr/include/db"
43+ CCARGS="$CCARGS -I"$BUILD_SYSROOT"/usr/include/db"
44 else
45 # No, we're not going to try db1 db2 db3 etc.
46 # On a properly installed system, Postfix builds
47@@ -307,12 +304,12 @@ case "$SYSTEM.$RELEASE" in
48 echo "Install the appropriate db*-devel package first." 1>&2
49 exit 1
50 fi
51- SYSLIBS="-ldb"
52+ SYSLIBS="$SYSLIBS -ldb"
53 ;;
54 esac
55 for name in nsl resolv $GDBM_LIBS
56 do
57- for lib in /usr/lib64 /lib64 /usr/lib /lib
58+ for lib in $BUILD_SYSROOT_NSL_PATH
59 do
60 test -e $lib/lib$name.a -o -e $lib/lib$name.so && {
61 SYSLIBS="$SYSLIBS -l$name"
62@@ -332,7 +329,7 @@ case "$SYSTEM.$RELEASE" in
63 if [ `expr "X$CCARGS" : "X.*-DNO_EPOLL"` -gt 0 ]
64 then
65 :
66- elif [ ! -e /usr/include/sys/epoll.h ]
67+ elif [ ! -e "$BUILD_SYSROOT"/usr/include/sys/epoll.h ]
68 then
69 echo CCARGS="$CCARGS -DNO_EPOLL"
70 else
71@@ -356,8 +353,6 @@ int main(int argc, char **argv)
72 }
73 EOF
74 ${CC-gcc} -o makedefs.test makedefs.test.c || exit 1
75- ./makedefs.test 2>/dev/null ||
76- CCARGS="$CCARGS -DNO_EPOLL"
77 rm -f makedefs.test makedefs.test.[co]
78 fi;;
79 esac
80@@ -366,12 +361,12 @@ EOF
81 case "$CCARGS" in
82 *-DNO_DB*) ;;
83 *-DHAS_DB*) ;;
84- *) if [ -f /usr/include/db.h ]
85+ *) if [ -f "$BUILD_SYSROOT"/usr/include/db.h ]
86 then
87 : we are all set
88- elif [ -f /usr/include/db/db.h ]
89+ elif [ -f "$BUILD_SYSROOT"/usr/include/db/db.h ]
90 then
91- CCARGS="$CCARGS -I/usr/include/db"
92+ CCARGS="$CCARGS -I"$BUILD_SYSROOT"/usr/include/db"
93 else
94 # On a properly installed system, Postfix builds
95 # by including <db.h> and by linking with -ldb
96@@ -379,7 +374,7 @@ EOF
97 echo "Install the appropriate db*-devel package first." 1>&2
98 exit 1
99 fi
100- SYSLIBS="-ldb"
101+ SYSLIBS="$SYSLIBS -ldb"
102 ;;
103 esac
104 for name in nsl resolv
105@@ -415,7 +410,7 @@ EOF
106 esac
107 for name in nsl resolv
108 do
109- for lib in /usr/lib64 /lib64 /usr/lib /lib
110+ for lib in $BUILD_SYSROOT_NSL_PATH
111 do
112 test -e $lib/lib$name.a -o -e $lib/lib$name.so && {
113 SYSLIBS="$SYSLIBS -l$name"
114--
1151.7.1
116
diff --git a/meta-networking/recipes-daemons/postfix/files/postfix b/meta-networking/recipes-daemons/postfix/files/postfix
new file mode 100755
index 000000000..7bcc81625
--- /dev/null
+++ b/meta-networking/recipes-daemons/postfix/files/postfix
@@ -0,0 +1,85 @@
1#!/bin/sh
2
3success() {
4 echo " Successful"
5 exit 0
6}
7
8fail() {
9 echo " Failed"
10 exit 1
11
12}
13
14check_return () {
15 local ret="$1"
16
17 if [ "$ret" = "0" ]; then
18 success
19 else
20 fail
21 fi
22}
23
24PIDFile=/var/spool/postfix/pid/master.pid
25case "$1" in
26
27 start)
28 echo -n "Starting Postfix..."
29 if [ ! -e /etc/aliases.db ]; then
30 # The alias database is necessary for postfix to work correctly.
31 echo "Creating aliases database ..."
32 newaliases
33 fi
34 if ! postfix status >/dev/null 2>&1; then
35 postfix start
36 check_return $?
37 else
38 success
39 fi
40 ;;
41
42 stop)
43 echo -n "Stopping Postfix..."
44 if postfix status >/dev/null 2>&1; then
45 postfix stop
46 check_return $?
47 else
48 success
49 fi
50 ;;
51
52 reload)
53 echo -n "Reloading Postfix..."
54 if postfix status >/dev/null 2>&1; then
55 postfix reload
56 check_return $?
57 else
58 postfix start
59 check_return $?
60 fi
61 ;;
62
63 restart)
64 $0 stop
65 sleep 1
66 $0 start
67 ;;
68
69 status)
70 if postfix status >/dev/null 2>&1; then
71 pid=`sed -e 's/\s//g' $PIDFile`
72 echo "The Postfix mail system is running (PID: $pid)"
73 exit 0
74 else
75 echo "The Postfix mail system is not running"
76 exit 1
77 fi
78 ;;
79
80 *)
81 echo "Usage: $0 {start|stop|status|reload|restart}"
82 exit 1
83 ;;
84esac
85
diff --git a/meta-networking/recipes-daemons/postfix/files/postfix-add-db6-support.patch b/meta-networking/recipes-daemons/postfix/files/postfix-add-db6-support.patch
new file mode 100644
index 000000000..e3e28c843
--- /dev/null
+++ b/meta-networking/recipes-daemons/postfix/files/postfix-add-db6-support.patch
@@ -0,0 +1,26 @@
1Subject: [PATCH] add db6 support db6
2
3Upstream-Status: Backport
4
5Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
6---
7 src/util/dict_db.c | 3 ++-
8 1 files changed, 2 insertions(+), 1 deletions(-)
9
10diff --git a/src/util/dict_db.c b/src/util/dict_db.c
11index 93ee480..f1ae66b 100644
12--- a/src/util/dict_db.c
13+++ b/src/util/dict_db.c
14@@ -693,7 +693,8 @@ static DICT *dict_db_open(const char *class, const char *path, int open_flags,
15 msg_fatal("set DB cache size %d: %m", dict_db_cache_size);
16 if (type == DB_HASH && db->set_h_nelem(db, DICT_DB_NELM) != 0)
17 msg_fatal("set DB hash element count %d: %m", DICT_DB_NELM);
18-#if DB_VERSION_MAJOR == 5 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR > 0)
19+#if DB_VERSION_MAJOR == 6 || DB_VERSION_MAJOR == 5 || \
20+ (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR > 0)
21 if ((errno = db->open(db, 0, db_path, 0, type, db_flags, 0644)) != 0)
22 FREE_RETURN(dict_surrogate(class, path, open_flags, dict_flags,
23 "open database %s: %m", db_path));
24--
251.7.1
26
diff --git a/meta-networking/recipes-daemons/postfix/files/postfix.service b/meta-networking/recipes-daemons/postfix/files/postfix.service
new file mode 100644
index 000000000..6ea921478
--- /dev/null
+++ b/meta-networking/recipes-daemons/postfix/files/postfix.service
@@ -0,0 +1,14 @@
1[Unit]
2Description=Postfix Mail Transport Agent
3After=syslog.target network.target
4Conflicts=sendmail.service exim.service
5
6[Service]
7Type=forking
8PIDFile=/var/spool/postfix/pid/master.pid
9ExecStart=/usr/sbin/postfix start
10ExecReload=/usr/sbin/postfix reload
11ExecStop=/usr/sbin/postfix stop
12
13[Install]
14WantedBy=multi-user.target
diff --git a/meta-networking/recipes-daemons/postfix/postfix.inc b/meta-networking/recipes-daemons/postfix/postfix.inc
new file mode 100644
index 000000000..c58787ed6
--- /dev/null
+++ b/meta-networking/recipes-daemons/postfix/postfix.inc
@@ -0,0 +1,230 @@
1SUMMARY = "Postfix Mail Transport Agent"
2DESCRIPTION = "Postfix is Wietse Venema's mail server that started life at \
3IBM research as an alternative to the widely-used Sendmail program. \
4Postfix attempts to be fast, easy to administer, and secure. The outsidei \
5has a definite Sendmail-ish flavor, but the inside is completely different."
6
7HOMEPAGE= "http://www.postfix.org"
8SECTION = "console/network"
9DEPENDS = "virtual/db libpcre openssl postfix-native \
10 ${@base_contains('DISTRO_FEATURES', 'ldap', 'openldap', '', d)} \
11 ${@base_contains('DISTRO_FEATURES', 'sasl', 'cyrus-sasl', '', d)} \
12"
13DEPENDS_virtclass-native = "virtual/db-native openssl-native libpcre-native"
14
15LICENSE = "IPL-1.0"
16LIC_FILES_CHKSUM = "file://LICENSE;md5=64375f37431336ea1b1b3005fe3fa354"
17
18SRC_URI = "ftp://ftp.porcupine.org/mirrors/postfix-release/official/postfix-${PV}.tar.gz \
19 file://makedefs.patch \
20 file://install.patch \
21 file://main.cf_2.0 \
22 file://postfix \
23 file://internal_recipient \
24 file://postfix.service \
25 "
26
27S = "${WORKDIR}/postfix-${PV}"
28
29BBCLASSEXTEND = "native"
30
31inherit update-rc.d useradd update-alternatives systemd
32
33INITSCRIPT_NAME = "postfix"
34INITSCRIPT_PARAMS = "start 58 3 4 5 . stop 13 0 1 6 ."
35USERADD_PACKAGES = "${PN}"
36USERADD_PARAM_${PN} = \
37"-d /var/spool/postfix -r -g postfix --shell /bin/false postfix; \
38 -d /var/spool/vmail -r -u 5000 -g vmail --shell /bin/false vmail \
39"
40GROUPADD_PARAM_${PN} = "--system postfix;--system postdrop;-g 5000 --system vmail"
41
42export SYSLIBS = "${LDFLAGS}"
43
44# CCARGS specifies includes, defines
45# AUXLIBS specifies libraries
46# Linux2/Linux3 has HAS_DB defined
47# makedefs will make CC to be CC+CCARGS
48
49# ldap support
50export CCARGS-ldap = "\
51 ${@base_contains('DISTRO_FEATURES', 'ldap', '-DHAS_LDAP', '', d)}"
52export AUXLIBS-ldap = "\
53 ${@base_contains('DISTRO_FEATURES', 'ldap', '-lldap -llber', '', d)}"
54
55# no native openldap
56export CCARGS-ldap_virtclass-native = ""
57export AUXLIBS-ldap_virtclass-native = ""
58
59# SASL support -DUSE_LDAP_SASL -DUSE_SASL_AUTH
60# current openldap didn't enable SASL
61export CCARGS-sasl = "\
62 ${@base_contains('DISTRO_FEATURES', 'sasl', '-DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I=/usr/include/sasl', '', d)}"
63export AUXLIBS-sasl = "\
64 ${@base_contains('DISTRO_FEATURES', 'sasl', '-lsasl2', '', d)}"
65export CCARGS-sasl_virtclass-native = ""
66export AUXLIBS-sasl_virtclass-native = ""
67
68# PCRE, TLS support default
69export CCARGS = "${CFLAGS} -DHAS_PCRE -DUSE_TLS ${CCARGS-ldap} ${CCARGS-sasl}"
70export AUXLIBS = "-lpcre -lssl -lcrypto ${AUXLIBS-sasl} ${AUXLIBS-ldap}"
71export POSTCONF = "${STAGING_DIR_NATIVE}${sbindir_native}/postconf"
72
73# OPT,DEBUG is aready in CFLAGS
74# ignore the OPTS="CC=$CC" in Makefile it will not use the CC=$CC $CCARGS
75EXTRA_OEMAKE += "OPT= DEBUG= OPTS= "
76
77do_compile () {
78 unset CFLAGS CPPFLAGS CXXFLAGS
79 local native_build
80
81 native_build="${@['0', '1'][bb.data.inherits_class('native', d) or bb.data.inherits_class('nativesdk', d)]}"
82
83 # if not native build, then pass SYSTEM and RELEASE to makedefs
84 if [ "${native_build}" != "1" ]; then
85 # uname -s for target
86 SYSTEM="Linux"
87
88 # uname -r, use 2.6 as bottomline, even target kernel ver > 2.6
89 RELEASE="2.6.34"
90 sed -i -e \
91 "s:\$(SHELL) makedefs):\$(SHELL) makedefs $SYSTEM $RELEASE):" \
92 ${S}/Makefile.in
93 export BUILD_SYSROOT="${STAGING_DIR_HOST}"
94 export BUILD_SYSROOT_NSL_PATH="${STAGING_BASELIBDIR} \
95 ${STAGING_LIBDIR}"
96 else
97 # native build
98 export BUILD_SYSROOT="${STAGING_DIR_NATIVE}"
99
100 # ubuntu x86 host: /lib/x86_64-linux-gnu(64) /lib/i386-linux-gnu (32)
101 # on 64 bits, 32 libs in i386-linux-gnu
102 # let makedefs finds nsl and resolv libs, host CC will link
103 # the correct libraries
104 BUILD_SYSROOT_NSL_PATH="$(${CC} -print-search-dirs 2>/dev/null | \
105 sed -n '/^libraries: =/s/libraries: =//p' | \
106 sed -e 's/:/\n/g' | xargs -n1 readlink -f | \
107 grep -v 'gcc\|/[0-9.]\+$' | sort -u)"
108 if [ -z "$BUILD_SYSROOT_NSL_PATH" ]; then
109 BUILD_SYSROOT_NSL_PATH="/usr/lib64 /lib64 \
110 /lib/x86_64-linux-gnu \
111 /usr/lib /lib \
112 /lib/i386-linux-gnu"
113 fi
114 export BUILD_SYSROOT_NSL_PATH
115 fi
116
117 oe_runmake makefiles
118 oe_runmake
119}
120
121do_install_prepend_virtclass-native() {
122 export POSTCONF="bin/postconf"
123}
124
125SYSTEMD_SERVICE_${PN} = "postfix.service"
126SYSTEMD_AUTO_ENABLE = "disable"
127
128do_install () {
129 sh ./postfix-install 'install_root=${D}' \
130 'config_directory=${sysconfdir}/postfix' \
131 'daemon_directory=${exec_prefix}/libexec/postfix' \
132 'command_directory=${sbindir}' \
133 'queue_directory=${localstatedir}/spool/postfix' \
134 'sendmail_path=${sbindir}/sendmail.postfix' \
135 'newaliases_path=${bindir}/newaliases' \
136 'mailq_path=${bindir}/mailq' \
137 'manpage_directory=${mandir}' \
138 'readme_directory=${datadir}/doc/postfix' \
139 'data_directory=${localstatedir}/lib/postfix' \
140 -non-interactive
141 rm -rf ${D}${localstatedir}/spool/postfix
142 mv ${D}${sysconfdir}/postfix/main.cf ${D}${sysconfdir}/postfix/sample-main.cf
143 install -d ${D}${sysconfdir}/init.d
144 install -m 644 ${WORKDIR}/main.cf_2.0 ${D}${sysconfdir}/postfix/main.cf
145 install -m 755 ${WORKDIR}/postfix ${D}${sysconfdir}/init.d/postfix
146 install -m 644 ${WORKDIR}/internal_recipient ${D}${sysconfdir}/postfix/internal_recipient
147
148 install -d ${D}${systemd_unitdir}/system
149 install -m 0644 ${WORKDIR}/postfix.service ${D}${systemd_unitdir}/system
150 sed -i 's,/usr/sbin/,${sbindir}/,g' ${D}${systemd_unitdir}/system/postfix.service
151
152 install -m 770 -d ${D}${localstatedir}/spool/postfix
153 chown postfix:postfix ${D}${localstatedir}/spool/postfix
154 chown postfix:postfix ${D}${localstatedir}/lib/postfix
155
156 install -m 2755 -d ${D}${localstatedir}/spool/mail
157 chown postfix:nogroup ${D}${localstatedir}/spool/mail
158 install -m 0755 -d ${D}${localstatedir}/lib/postfix
159 chown postfix:nogroup ${D}${localstatedir}/lib/postfix
160 install -m 0755 -d ${D}${localstatedir}/spool/postfix
161 chown root:postfix ${D}${localstatedir}/spool/postfix
162 install -m 0700 -d ${D}${localstatedir}/spool/postfix/active
163 chown postfix:root ${D}${localstatedir}/spool/postfix/active
164 install -m 0700 -d ${D}${localstatedir}/spool/postfix/bounce
165 chown postfix:root ${D}${localstatedir}/spool/postfix/bounce
166 install -m 0700 -d ${D}${localstatedir}/spool/postfix/corrupt
167 chown postfix:root ${D}${localstatedir}/spool/postfix/corrupt
168 install -m 0700 -d ${D}${localstatedir}/spool/postfix/defer
169 chown postfix:root ${D}${localstatedir}/spool/postfix/defer
170 install -m 0700 -d ${D}${localstatedir}/spool/postfix/deferred
171 chown postfix:root ${D}${localstatedir}/spool/postfix/deferred
172 install -m 0700 -d ${D}${localstatedir}/spool/postfix/flush
173 chown postfix:root ${D}${localstatedir}/spool/postfix/flush
174 install -m 0700 -d ${D}${localstatedir}/spool/postfix/hold
175 chown postfix:root ${D}${localstatedir}/spool/postfix/hold
176 install -m 0700 -d ${D}${localstatedir}/spool/postfix/incoming
177 chown postfix:root ${D}${localstatedir}/spool/postfix/incoming
178 install -m 0700 -d ${D}${localstatedir}/spool/postfix/saved
179 chown postfix:root ${D}${localstatedir}/spool/postfix/saved
180 install -m 0700 -d ${D}${localstatedir}/spool/postfix/trace
181 chown postfix:root ${D}${localstatedir}/spool/postfix/trace
182 install -m 0730 -d ${D}${localstatedir}/spool/postfix/maildrop
183 chown postfix:postdrop ${D}${localstatedir}/spool/postfix/maildrop
184 install -m 0755 -d ${D}${localstatedir}/spool/postfix/pid
185 chown root:root ${D}${localstatedir}/spool/postfix/pid
186 install -m 0700 -d ${D}${localstatedir}/spool/postfix/private
187 chown postfix:root ${D}${localstatedir}/spool/postfix/private
188 install -m 0710 -d ${D}${localstatedir}/spool/postfix/public
189 chown postfix:postdrop ${D}${localstatedir}/spool/postfix/public
190 install -m 0755 -d ${D}${localstatedir}/spool/vmail
191 chown vmail:vmail ${D}${localstatedir}/spool/vmail
192
193 chown :postdrop ${D}${sbindir}/postqueue
194 chown :postdrop ${D}${sbindir}/postdrop
195 chmod g+s ${D}${sbindir}/postqueue
196 chmod g+s ${D}${sbindir}/postdrop
197}
198
199do_install_append_class-native() {
200 ln -sf ../sbin/sendmail.postfix ${D}${bindir}/newaliases
201 ln -sf ../sbin/sendmail.postfix ${D}${bindir}/mailq
202}
203
204NATIVE_INSTALL_WORKS = "1"
205
206ALTERNATIVE_${PN} = "sendmail"
207ALTERNATIVE_TARGET[sendmail] = "${sbindir}/sendmail.postfix"
208ALTERNATIVE_LINK_NAME[sendmail] = "${sbindir}/sendmail"
209ALTERNATIVE_PRIORITY = "120"
210
211pkg_postinst_${PN} () {
212 if [ "x$D" = "x" ]; then
213 touch /etc/aliases
214 newaliases
215
216 # generate virtual_alias, default is hash
217 touch /etc/postfix/virtual_alias
218 postmap /etc/postfix/virtual_alias
219 else
220 touch $D/etc/aliases
221 newaliases -C $D/etc/postfix/main.cf -oA$D/etc/aliases
222 touch $D/etc/postfix/virtual_alias
223 postmap -c $D/etc/postfix $D/etc/postfix/virtual_alias
224 fi
225}
226
227# Exclude .debug directories from the main package
228FILES_${PN} = "${sysconfdir} ${localstatedir} ${bindir}/* ${sbindir}/* \
229 ${exec_prefix}/libexec/postfix/* ${systemd_unitdir}/*"
230FILES_${PN}-dbg += "${exec_prefix}/libexec/postfix/.debug"
diff --git a/meta-networking/recipes-daemons/postfix/postfix_2.11.1.bb b/meta-networking/recipes-daemons/postfix/postfix_2.11.1.bb
new file mode 100644
index 000000000..8f237dc2e
--- /dev/null
+++ b/meta-networking/recipes-daemons/postfix/postfix_2.11.1.bb
@@ -0,0 +1,6 @@
1require postfix.inc
2
3SRC_URI += "file://postfix-add-db6-support.patch"
4
5SRC_URI[md5sum] = "56ac1f1a79737c4ac1e24535a122a4a6"
6SRC_URI[sha256sum] = "487f98a73b95a5799409caf21ec065efea91c1dcdfb84c038a0e3a265d6489e2"