From c78eca1ea7452a62f86b740ec59f1cd39e399d73 Mon Sep 17 00:00:00 2001 From: Roy Li Date: Mon, 10 Nov 2014 13:05:37 +0800 Subject: postfix: create or update aliases.db when using systemd aliases.db should be created by postinstall script, but failed since queue_directory is not includes root dir ${D}: ------ |newaliases: fatal: chdir /var/spool/postfix: No such file or directory ------ initscript will recall newaliases before start postfix daemon, the similar method, which run aliasesdb to create aliases.db when using systemd, is introduced to fix this issue. Signed-off-by: Roy.Li Signed-off-by: Joe MacDonald --- .../recipes-daemons/postfix/files/aliasesdb | 20 ++++++++++++++++++++ .../recipes-daemons/postfix/files/postfix.service | 1 + 2 files changed, 21 insertions(+) create mode 100755 meta-networking/recipes-daemons/postfix/files/aliasesdb (limited to 'meta-networking/recipes-daemons/postfix/files') diff --git a/meta-networking/recipes-daemons/postfix/files/aliasesdb b/meta-networking/recipes-daemons/postfix/files/aliasesdb new file mode 100755 index 0000000000..855a64f705 --- /dev/null +++ b/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-networking/recipes-daemons/postfix/files/postfix.service b/meta-networking/recipes-daemons/postfix/files/postfix.service index 6ea9214780..c781038d88 100644 --- a/meta-networking/recipes-daemons/postfix/files/postfix.service +++ b/meta-networking/recipes-daemons/postfix/files/postfix.service @@ -6,6 +6,7 @@ Conflicts=sendmail.service exim.service [Service] Type=forking PIDFile=/var/spool/postfix/pid/master.pid +ExecStartPre=-/usr/libexec/postfix/aliasesdb ExecStart=/usr/sbin/postfix start ExecReload=/usr/sbin/postfix reload ExecStop=/usr/sbin/postfix stop -- cgit v1.2.3-54-g00ecf