mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-06-04 02:31:27 +00:00
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 <rongqing.li@windriver.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
This commit is contained in:
+20
@@ -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
|
||||||
@@ -6,6 +6,7 @@ Conflicts=sendmail.service exim.service
|
|||||||
[Service]
|
[Service]
|
||||||
Type=forking
|
Type=forking
|
||||||
PIDFile=/var/spool/postfix/pid/master.pid
|
PIDFile=/var/spool/postfix/pid/master.pid
|
||||||
|
ExecStartPre=-/usr/libexec/postfix/aliasesdb
|
||||||
ExecStart=/usr/sbin/postfix start
|
ExecStart=/usr/sbin/postfix start
|
||||||
ExecReload=/usr/sbin/postfix reload
|
ExecReload=/usr/sbin/postfix reload
|
||||||
ExecStop=/usr/sbin/postfix stop
|
ExecStop=/usr/sbin/postfix stop
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ SRC_URI = "ftp://ftp.porcupine.org/mirrors/postfix-release/official/postfix-${PV
|
|||||||
file://postfix \
|
file://postfix \
|
||||||
file://internal_recipient \
|
file://internal_recipient \
|
||||||
file://postfix.service \
|
file://postfix.service \
|
||||||
|
file://aliasesdb \
|
||||||
"
|
"
|
||||||
|
|
||||||
S = "${WORKDIR}/postfix-${PV}"
|
S = "${WORKDIR}/postfix-${PV}"
|
||||||
@@ -149,6 +150,8 @@ do_install () {
|
|||||||
install -m 0644 ${WORKDIR}/postfix.service ${D}${systemd_unitdir}/system
|
install -m 0644 ${WORKDIR}/postfix.service ${D}${systemd_unitdir}/system
|
||||||
sed -i 's,/usr/sbin/,${sbindir}/,g' ${D}${systemd_unitdir}/system/postfix.service
|
sed -i 's,/usr/sbin/,${sbindir}/,g' ${D}${systemd_unitdir}/system/postfix.service
|
||||||
|
|
||||||
|
install -m 0755 ${WORKDIR}/aliasesdb ${D}${exec_prefix}/libexec/postfix/
|
||||||
|
|
||||||
install -m 770 -d ${D}${localstatedir}/spool/postfix
|
install -m 770 -d ${D}${localstatedir}/spool/postfix
|
||||||
chown postfix:postfix ${D}${localstatedir}/spool/postfix
|
chown postfix:postfix ${D}${localstatedir}/spool/postfix
|
||||||
chown postfix:postfix ${D}${localstatedir}/lib/postfix
|
chown postfix:postfix ${D}${localstatedir}/lib/postfix
|
||||||
|
|||||||
Reference in New Issue
Block a user