Skip to contentSkip to conversation

postfix: move running newaliases back to pkg_postinst

PATCH In review Joe Slater 2 participants 3 messages Feb 1, 2018 – Feb 2, 2018

lore
Share & tools
lore

Joe Slater

author
#0 lore raw

PATCH 1/1 postfix: move running newaliases back to pkg_postinst

newaliases, when run on the host, will fail if /var/spool/postfix does not exist. Run it during pkg_postinst() so that we can defer it to first boot.

---
 meta-networking/recipes-daemons/postfix/postfix.inc | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
meta-networking/recipes-daemons/postfix/postfix.inc +7 -6
index e48fc39..d5d0789 100644
@@ -217,12 +217,6 @@ do_install_append_class-native() {
 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
-    # Since we are building recipe postfix, newaliases and postmap come from our sysroot_native.
-    touch ${D}/etc/aliases
-    newaliases -C ${D}/etc/postfix/main.cf -oA${D}/etc/aliases
-    touch ${D}/etc/postfix/virtual_alias
-    postmap -c ${D}/etc/postfix ${D}/etc/postfix/virtual_alias
-
 }
 
 ALTERNATIVE_${PN} = "sendmail"
@@ -235,6 +229,7 @@ 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
@@ -248,6 +243,12 @@ pkg_postinst_${PN} () {
             # /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
+        # fails if /var/spool/postfix is not on host
+        newaliases -C $D/etc/postfix/main.cf -oA$D/etc/aliases  ||  exit 1
+        touch $D/etc/postfix/virtual_alias
+        postmap -c $D/etc/postfix $D/etc/postfix/virtual_alias
     fi
 }
 
Signature · 1 line
2.7.4
#1 lore raw

How is this one related to:
https://patchwork.openembedded.org/patch/147161/
?

Quoted 62 lines · Joe Slater

newaliases, when run on the host, will fail if /var/spool/postfix does not exist. Run it during pkg_postinst() so that we can defer it to first boot.

---
 meta-networking/recipes-daemons/postfix/postfix.inc | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
meta-networking/recipes-daemons/postfix/postfix.inc +0 -0
index e48fc39..d5d0789 100644
@@ -217,12 +217,6 @@ do_install_append_class-native() {
 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
- # Since we are building recipe postfix, newaliases and postmap come
from our sysroot_native.

meta-networking/recipes-daemons/postfix/postfix.inc +0 -5
-    touch ${D}/etc/aliases
-    newaliases -C ${D}/etc/postfix/main.cf -oA${D}/etc/aliases
-    touch ${D}/etc/postfix/virtual_alias
-    postmap -c ${D}/etc/postfix ${D}/etc/postfix/virtual_alias
-
 }
 
 ALTERNATIVE_${PN} = "sendmail"
@@ -235,6 +229,7 @@ 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"

meta-networking/recipes-daemons/postfix/postfix.inc +1 -0
+PACKAGE_WRITE_DEPS += "postfix-native"
 pkg_postinst_${PN} () {
     if [ "x$D" = "x" ]; then
         touch /etc/aliases
@@ -248,6 +243,12 @@ pkg_postinst_${PN} () {
             # /usr/lib/sendmail is required by LSB core test
             [ ! -L $D/usr/lib/sendmail ] && ln -sf ${sbindir}/sendmail

$D/usr/lib/
fi

meta-networking/recipes-daemons/postfix/postfix.inc +4 -0
+
+        touch $D/etc/aliases
+        # fails if /var/spool/postfix is not on host
+        newaliases -C $D/etc/postfix/main.cf -oA$D/etc/aliases  ||  exit

1

meta-networking/recipes-daemons/postfix/postfix.inc +2 -1
+        touch $D/etc/postfix/virtual_alias
+        postmap -c $D/etc/postfix $D/etc/postfix/virtual_alias
     fi
 }
 
--

2.7.4

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

#2 lore raw

The one you reference fixes several things. Best to merge that one. However, if newaliases fails during pkg_postinst(), I believe the system will not know to schedule the script at first boot unless we ‘exit 1’. We also need to create the sendmail link before this or do it someplace else.

Joe

From: Martin Jansa [mailto:[email protected]]
Sent: Thursday, February 01, 2018 1:39 PM
To: Slater, Joseph
Cc: openembedded-devel
Subject: Re: [oe] [meta-networking][PATCH 1/1] postfix: move running newaliases back to pkg_postinst

How is this one related to:
https://patchwork.openembedded.org/patch/147161/
?

On Thu, Feb 1, 2018 at 10:26 PM, Joe Slater <[email protected]<mailto:[email protected]>> wrote:
newaliases, when run on the host, will fail if /var/spool/postfix
does not exist. Run it during pkg_postinst() so that we can defer
it to first boot.

---
 meta-networking/recipes-daemons/postfix/postfix.inc | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
meta-networking/recipes-daemons/postfix/postfix.inc +7 -6
index e48fc39..d5d0789 100644
@@ -217,12 +217,6 @@ do_install_append_class-native() {
 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
-    # Since we are building recipe postfix, newaliases and postmap come from our sysroot_native.
-    touch ${D}/etc/aliases
-    newaliases -C ${D}/etc/postfix/main.cf<http://main.cf> -oA${D}/etc/aliases
-    touch ${D}/etc/postfix/virtual_alias
-    postmap -c ${D}/etc/postfix ${D}/etc/postfix/virtual_alias
-
 }
 
 ALTERNATIVE_${PN} = "sendmail"
@@ -235,6 +229,7 @@ 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
@@ -248,6 +243,12 @@ pkg_postinst_${PN} () {
             # /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
+        # fails if /var/spool/postfix is not on host
+        newaliases -C $D/etc/postfix/main.cf<http://main.cf> -oA$D/etc/aliases  ||  exit 1
+        touch $D/etc/postfix/virtual_alias
+        postmap -c $D/etc/postfix $D/etc/postfix/virtual_alias
     fi
 }
 

--
2.7.4

--
_______________________________________________
Openembedded-devel mailing list [email protected]<mailto:[email protected]>
http://lists.openembedded.org/mailman/listinfo/openembedded-devel