* [PATCH][meta-networking] postfix: create or update aliases.db when using systemd
@ 2014-11-10 1:03 rongqing.li
2014-11-10 2:19 ` Rongqing Li
0 siblings, 1 reply; 2+ messages in thread
From: rongqing.li @ 2014-11-10 1:03 UTC (permalink / raw)
To: openembedded-devel
From: Roy Li <rongqing.li@windriver.com>
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>
---
.../recipes-daemons/postfix/files/aliasesdb | 20 ++++++++++++++++++++
.../recipes-daemons/postfix/files/postfix.service | 1 +
meta-networking/recipes-daemons/postfix/postfix.inc | 3 +++
3 files changed, 24 insertions(+)
create mode 100755 meta-networking/recipes-daemons/postfix/files/aliasesdb
diff --git a/meta-networking/recipes-daemons/postfix/files/aliasesdb b/meta-networking/recipes-daemons/postfix/files/aliasesdb
new file mode 100755
index 0000000..421b47e
--- /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 6ea9214..c781038 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
diff --git a/meta-networking/recipes-daemons/postfix/postfix.inc b/meta-networking/recipes-daemons/postfix/postfix.inc
index c58787e..d2f3356 100644
--- a/meta-networking/recipes-daemons/postfix/postfix.inc
+++ b/meta-networking/recipes-daemons/postfix/postfix.inc
@@ -22,6 +22,7 @@ SRC_URI = "ftp://ftp.porcupine.org/mirrors/postfix-release/official/postfix-${PV
file://postfix \
file://internal_recipient \
file://postfix.service \
+ file://aliasesdb \
"
S = "${WORKDIR}/postfix-${PV}"
@@ -149,6 +150,8 @@ do_install () {
install -m 0644 ${WORKDIR}/postfix.service ${D}${systemd_unitdir}/system
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
chown postfix:postfix ${D}${localstatedir}/spool/postfix
chown postfix:postfix ${D}${localstatedir}/lib/postfix
--
2.1.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH][meta-networking] postfix: create or update aliases.db when using systemd
2014-11-10 1:03 [PATCH][meta-networking] postfix: create or update aliases.db when using systemd rongqing.li
@ 2014-11-10 2:19 ` Rongqing Li
0 siblings, 0 replies; 2+ messages in thread
From: Rongqing Li @ 2014-11-10 2:19 UTC (permalink / raw)
To: openembedded-devel
On 2014年11月10日 09:03, rongqing.li@windriver.com wrote:
> From: Roy Li <rongqing.li@windriver.com>
>
> 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>
> ---
> .../recipes-daemons/postfix/files/aliasesdb | 20 ++++++++++++++++++++
> .../recipes-daemons/postfix/files/postfix.service | 1 +
> meta-networking/recipes-daemons/postfix/postfix.inc | 3 +++
> 3 files changed, 24 insertions(+)
> create mode 100755 meta-networking/recipes-daemons/postfix/files/aliasesdb
>
> diff --git a/meta-networking/recipes-daemons/postfix/files/aliasesdb b/meta-networking/recipes-daemons/postfix/files/aliasesdb
> new file mode 100755
> index 0000000..421b47e
> --- /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" ]
drop it, "==" is for bash, I will fix it.
-Roy
> + 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 6ea9214..c781038 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
> diff --git a/meta-networking/recipes-daemons/postfix/postfix.inc b/meta-networking/recipes-daemons/postfix/postfix.inc
> index c58787e..d2f3356 100644
> --- a/meta-networking/recipes-daemons/postfix/postfix.inc
> +++ b/meta-networking/recipes-daemons/postfix/postfix.inc
> @@ -22,6 +22,7 @@ SRC_URI = "ftp://ftp.porcupine.org/mirrors/postfix-release/official/postfix-${PV
> file://postfix \
> file://internal_recipient \
> file://postfix.service \
> + file://aliasesdb \
> "
>
> S = "${WORKDIR}/postfix-${PV}"
> @@ -149,6 +150,8 @@ do_install () {
> install -m 0644 ${WORKDIR}/postfix.service ${D}${systemd_unitdir}/system
> 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
> chown postfix:postfix ${D}${localstatedir}/spool/postfix
> chown postfix:postfix ${D}${localstatedir}/lib/postfix
>
--
Best Reagrds,
Roy | RongQing Li
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-11-10 2:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-10 1:03 [PATCH][meta-networking] postfix: create or update aliases.db when using systemd rongqing.li
2014-11-10 2:19 ` Rongqing Li
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.