Skip to contentSkip to conversation

postfix: fix pkg_postinst_${PN}

PATCH Superseded [email protected] 3 participants 7 messages Sep 13, 2018 – Sep 14, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 postfix: fix pkg_postinst_${PN}

From: Mingli Yu <[email protected]>

"exit 0" will break the postinst logic
below the line "exit 0" such as:
===
update-alternatives --install /usr/sbin/sendmail sendmail /usr/sbin/sendmail.postfix 120 update-alternatives --install /usr/bin/mailq mailq /usr/bin/mailq.postfix 120 update-alternatives --install /usr/bin/newaliases newaliases /usr/bin/newaliases.postfix 120
===

It's enough to call "$INTERCEPT_DIR/postinst_intercept delay_to_first_boot ${PKG} mlprefix=${MLPREFIX}" , so remove it to guarantee the postinstall logic is correct

---
 meta-networking/recipes-daemons/postfix/postfix.inc | 1 -
 1 file changed, 1 deletion(-)
meta-networking/recipes-daemons/postfix/postfix.inc +0 -1
index 49f9f7b1f..71d7ef5df 100644
@@ -246,7 +246,6 @@ pkg_postinst_${PN} () {
         # This can fail depending on host setup
         if ! newaliases -C $D/etc/postfix/main.cf -oA$D/etc/aliases; then
             $INTERCEPT_DIR/postinst_intercept delay_to_first_boot ${PKG} mlprefix=${MLPREFIX}
-            exit 0
         fi
         touch $D/etc/postfix/virtual_alias
         postmap -c $D/etc/postfix $D/etc/postfix/virtual_alias
Signature · 1 line
2.13.3
#1 lore raw
Quoted 23 lines · On 09/13/2018 04:23 PM, [email protected] wrote:

From: Mingli Yu <[email protected]>

"exit 0" will break the postinst logic
below the line "exit 0" such as:
===
update-alternatives --install /usr/sbin/sendmail sendmail /usr/sbin/sendmail.postfix 120 update-alternatives --install /usr/bin/mailq mailq /usr/bin/mailq.postfix 120 update-alternatives --install /usr/bin/newaliases newaliases /usr/bin/newaliases.postfix 120
===

It's enough to call "$INTERCEPT_DIR/postinst_intercept delay_to_first_boot ${PKG} mlprefix=${MLPREFIX}" , so remove it to guarantee the postinstall logic is correct

---
  meta-networking/recipes-daemons/postfix/postfix.inc | 1 -
  1 file changed, 1 deletion(-)
meta-networking/recipes-daemons/postfix/postfix.inc +0 -0
index 49f9f7b1f..71d7ef5df 100644

meta-networking/recipes-daemons/postfix/postfix.inc pkg_postinst_${PN} () { · line 251

Quoted 7 lines
meta-networking/recipes-daemons/postfix/postfix.inc +0 -1
@@ -246,7 +246,6 @@ pkg_postinst_${PN} () {
          # This can fail depending on host setup
          if ! newaliases -C $D/etc/postfix/main.cf -oA$D/etc/aliases; then
              $INTERCEPT_DIR/postinst_intercept delay_to_first_boot ${PKG} mlprefix=${MLPREFIX}
-            exit 0
          fi
          touch $D/etc/postfix/virtual_alias
          postmap -c $D/etc/postfix $D/etc/postfix/virtual_alias

I guess you need to use the if...else... block here.

Regards,
Chen Qi

author
#2 lore raw
Quoted 23 lines · ChenQi
Quoted 22 lines · On 09/13/2018 04:23 PM, [email protected] wrote:

From: Mingli Yu <[email protected]>

"exit 0" will break the postinst logic
below the line "exit 0" such as:
===
update-alternatives --install /usr/sbin/sendmail sendmail /usr/sbin/sendmail.postfix 120
update-alternatives --install /usr/bin/mailq mailq /usr/bin/mailq.postfix 120
update-alternatives --install /usr/bin/newaliases newaliases /usr/bin/newaliases.postfix 120
===

It's enough to call "$INTERCEPT_DIR/postinst_intercept delay_to_first_boot ${PKG} mlprefix=${MLPREFIX}"
, so remove it to guarantee the postinstall logic is correct

---
  meta-networking/recipes-daemons/postfix/postfix.inc | 1 -
  1 file changed, 1 deletion(-)
Quoted 16 lines
Quoted 8 lines
meta-networking/recipes-daemons/postfix/postfix.inc +0 -0
index 49f9f7b1f..71d7ef5df 100644
@@ -246,7 +246,6 @@ pkg_postinst_${PN} () {
          # This can fail depending on host setup
          if ! newaliases -C $D/etc/postfix/main.cf -oA$D/etc/aliases;
Quoted 7 lines

then
$INTERCEPT_DIR/postinst_intercept delay_to_first_boot
${PKG} mlprefix=${MLPREFIX}
- exit 0
fi
touch $D/etc/postfix/virtual_alias
postmap -c $D/etc/postfix $D/etc/postfix/virtual_alias

I guess you need to use the if...else... block here.

Thanks Qi, Will send out v2 to update the logic.

Thanks,

Quoted 4 lines

Regards,
Chen Qi

#3 lore raw

PATCH v2 1/1 postfix: fix pkg_postinst_${PN}

In reply to ChenQi

From: Mingli Yu <[email protected]>

"exit 0" will break the postinst logic
below the line "exit 0" such as:
===
update-alternatives --install /usr/sbin/sendmail sendmail /usr/sbin/sendmail.postfix 120 update-alternatives --install /usr/bin/mailq mailq /usr/bin/mailq.postfix 120 update-alternatives --install /usr/bin/newaliases newaliases /usr/bin/newaliases.postfix 120
===

It's enough to call "$INTERCEPT_DIR/postinst_intercept delay_to_first_boot ${PKG} mlprefix=${MLPREFIX}" , so remove it to guarantee the postinstall logic is correct

---
 meta-networking/recipes-daemons/postfix/postfix.inc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
meta-networking/recipes-daemons/postfix/postfix.inc +3 -3
index 49f9f7b1f..882b27b6e 100644
@@ -246,10 +246,10 @@ pkg_postinst_${PN} () {
         # This can fail depending on host setup
         if ! newaliases -C $D/etc/postfix/main.cf -oA$D/etc/aliases; then
             $INTERCEPT_DIR/postinst_intercept delay_to_first_boot ${PKG} mlprefix=${MLPREFIX}
-            exit 0
+        else
+            touch $D/etc/postfix/virtual_alias
+            postmap -c $D/etc/postfix $D/etc/postfix/virtual_alias
         fi
-        touch $D/etc/postfix/virtual_alias
-        postmap -c $D/etc/postfix $D/etc/postfix/virtual_alias
 
     fi
 }
Signature · 1 line
2.13.3
#4 lore raw

I might not be understanding this. Why is the original fragment incorrect and the new one correct?

Original:

# This can fail depending on host setup
if ! newaliases -C $D/etc/postfix/main.cf -oA$D/etc/aliases; then
$INTERCEPT_DIR/postinst_intercept delay_to_first_boot
${PKG} mlprefix=${MLPREFIX}
exit 0
fi
touch $D/etc/postfix/virtual_alias
postmap -c $D/etc/postfix $D/etc/postfix/virtual_alias

fi
}

Patched:

if ! newaliases -C $D/etc/postfix/main.cf -oA$D/etc/aliases; then
$INTERCEPT_DIR/postinst_intercept delay_to_first_boot
${PKG} mlprefix=${MLPREFIX}
else
touch $D/etc/postfix/virtual_alias
postmap -c $D/etc/postfix $D/etc/postfix/virtual_alias
fi

fi
}

What problem is being fixed here?

Alex

2018-09-13 11:34 GMT+02:00 <[email protected]>:

Quoted 44 lines

From: Mingli Yu <[email protected]>

"exit 0" will break the postinst logic
below the line "exit 0" such as:
===
update-alternatives --install /usr/sbin/sendmail sendmail /usr/sbin/sendmail.postfix 120 update-alternatives --install /usr/bin/mailq mailq /usr/bin/mailq.postfix 120 update-alternatives --install /usr/bin/newaliases newaliases /usr/bin/newaliases.postfix 120
===

It's enough to call "$INTERCEPT_DIR/postinst_intercept delay_to_first_boot ${PKG} mlprefix=${MLPREFIX}" , so remove it to guarantee the postinstall logic is correct

---
 meta-networking/recipes-daemons/postfix/postfix.inc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
meta-networking/recipes-daemons/postfix/postfix.inc +3 -4
index 49f9f7b1f..882b27b6e 100644
@@ -246,10 +246,10 @@ pkg_postinst_${PN} () {
         # This can fail depending on host setup
         if ! newaliases -C $D/etc/postfix/main.cf -oA$D/etc/aliases; then
             $INTERCEPT_DIR/postinst_intercept delay_to_first_boot ${PKG} mlprefix=${MLPREFIX}
-            exit 0
+        else
+            touch $D/etc/postfix/virtual_alias
+            postmap -c $D/etc/postfix $D/etc/postfix/virtual_alias
         fi
-        touch $D/etc/postfix/virtual_alias
-        postmap -c $D/etc/postfix $D/etc/postfix/virtual_alias
 
     fi
 }
--

2.13.3

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

#5 lore raw

Ah, now I get it - there might be more lines in the postinst script added from elsewhere. Correct?

Alex

2018-09-13 13:07 GMT+02:00 Alexander Kanavin <[email protected]>:

Quoted 82 lines

I might not be understanding this. Why is the original fragment incorrect and the new one correct?

Original:

# This can fail depending on host setup
if ! newaliases -C $D/etc/postfix/main.cf -oA$D/etc/aliases; then
$INTERCEPT_DIR/postinst_intercept delay_to_first_boot
${PKG} mlprefix=${MLPREFIX}
exit 0
fi
touch $D/etc/postfix/virtual_alias
postmap -c $D/etc/postfix $D/etc/postfix/virtual_alias

fi
}

Patched:

if ! newaliases -C $D/etc/postfix/main.cf -oA$D/etc/aliases; then
$INTERCEPT_DIR/postinst_intercept delay_to_first_boot
${PKG} mlprefix=${MLPREFIX}
else
touch $D/etc/postfix/virtual_alias
postmap -c $D/etc/postfix $D/etc/postfix/virtual_alias
fi

fi
}

What problem is being fixed here?

Alex

2018-09-13 11:34 GMT+02:00 <[email protected]>:

Quoted 44 lines

From: Mingli Yu <[email protected]>

"exit 0" will break the postinst logic
below the line "exit 0" such as:
===
update-alternatives --install /usr/sbin/sendmail sendmail /usr/sbin/sendmail.postfix 120 update-alternatives --install /usr/bin/mailq mailq /usr/bin/mailq.postfix 120 update-alternatives --install /usr/bin/newaliases newaliases /usr/bin/newaliases.postfix 120
===

It's enough to call "$INTERCEPT_DIR/postinst_intercept delay_to_first_boot ${PKG} mlprefix=${MLPREFIX}" , so remove it to guarantee the postinstall logic is correct

---
 meta-networking/recipes-daemons/postfix/postfix.inc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
meta-networking/recipes-daemons/postfix/postfix.inc +3 -4
index 49f9f7b1f..882b27b6e 100644
@@ -246,10 +246,10 @@ pkg_postinst_${PN} () {
         # This can fail depending on host setup
         if ! newaliases -C $D/etc/postfix/main.cf -oA$D/etc/aliases; then
             $INTERCEPT_DIR/postinst_intercept delay_to_first_boot ${PKG} mlprefix=${MLPREFIX}
-            exit 0
+        else
+            touch $D/etc/postfix/virtual_alias
+            postmap -c $D/etc/postfix $D/etc/postfix/virtual_alias
         fi
-        touch $D/etc/postfix/virtual_alias
-        postmap -c $D/etc/postfix $D/etc/postfix/virtual_alias
 
     fi
 }
--

2.13.3

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

author
#6 lore raw
Quoted 2 lines · Alexander Kanavin

Ah, now I get it - there might be more lines in the postinst script added from elsewhere. Correct?

Hi Alex,

You are right, there is some other postinst script logic added such as by update-alternatives.bbclass.

Thanks,

Quoted 88 lines

Alex

2018-09-13 13:07 GMT+02:00 Alexander Kanavin <[email protected]>:

Quoted 82 lines

I might not be understanding this. Why is the original fragment incorrect and the new one correct?

Original:

# This can fail depending on host setup
if ! newaliases -C $D/etc/postfix/main.cf -oA$D/etc/aliases; then
$INTERCEPT_DIR/postinst_intercept delay_to_first_boot
${PKG} mlprefix=${MLPREFIX}
exit 0
fi
touch $D/etc/postfix/virtual_alias
postmap -c $D/etc/postfix $D/etc/postfix/virtual_alias

fi
}

Patched:

if ! newaliases -C $D/etc/postfix/main.cf -oA$D/etc/aliases; then
$INTERCEPT_DIR/postinst_intercept delay_to_first_boot
${PKG} mlprefix=${MLPREFIX}
else
touch $D/etc/postfix/virtual_alias
postmap -c $D/etc/postfix $D/etc/postfix/virtual_alias
fi

fi
}

What problem is being fixed here?

Alex

2018-09-13 11:34 GMT+02:00 <[email protected]>:

Quoted 44 lines

From: Mingli Yu <[email protected]>

"exit 0" will break the postinst logic
below the line "exit 0" such as:
===
update-alternatives --install /usr/sbin/sendmail sendmail /usr/sbin/sendmail.postfix 120 update-alternatives --install /usr/bin/mailq mailq /usr/bin/mailq.postfix 120 update-alternatives --install /usr/bin/newaliases newaliases /usr/bin/newaliases.postfix 120
===

It's enough to call "$INTERCEPT_DIR/postinst_intercept delay_to_first_boot ${PKG} mlprefix=${MLPREFIX}" , so remove it to guarantee the postinstall logic is correct

---
  meta-networking/recipes-daemons/postfix/postfix.inc | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
meta-networking/recipes-daemons/postfix/postfix.inc +3 -4
index 49f9f7b1f..882b27b6e 100644
@@ -246,10 +246,10 @@ pkg_postinst_${PN} () {
          # This can fail depending on host setup
          if ! newaliases -C $D/etc/postfix/main.cf -oA$D/etc/aliases; then
              $INTERCEPT_DIR/postinst_intercept delay_to_first_boot ${PKG} mlprefix=${MLPREFIX}
-            exit 0
+        else
+            touch $D/etc/postfix/virtual_alias
+            postmap -c $D/etc/postfix $D/etc/postfix/virtual_alias
          fi
-        touch $D/etc/postfix/virtual_alias
-        postmap -c $D/etc/postfix $D/etc/postfix/virtual_alias
 
      fi
  }
--

2.13.3

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