Skip to contentSkip to conversation

postfix: use alternatives to manage /usr/lib/sendmail

PATCH Superseded Chen Qi 1 participant 2 messages Jul 15, 2019

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Chen Qi

author
#0 lore raw

PATCH 1/2 postfix: use alternatives to manage /usr/lib/sendmail

There are several packages which all provide /usr/lib/sendmail when lsb is enabled. So use alternative to manage it.

---
 meta-networking/recipes-daemons/postfix/postfix.inc | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
meta-networking/recipes-daemons/postfix/postfix.inc +5 -6
index 3d4f1df..9437941 100644
@@ -196,11 +196,15 @@ do_install_append_class-native() {
     ln -sf ../sbin/sendmail.postfix ${D}${bindir}/mailq
 }
 
-ALTERNATIVE_${PN} += "sendmail mailq newaliases"
+ALTERNATIVE_${PN} = "sendmail mailq newaliases"
+# /usr/lib/sendmial is required by LSB core test
+ALTERNATIVE_${PN}_linuxstdbase = "sendmail mailq newaliases usr-lib-sendmail"
 ALTERNATIVE_TARGET[mailq] = "${bindir}/mailq"
 ALTERNATIVE_TARGET[newaliases] = "${bindir}/newaliases"
 ALTERNATIVE_TARGET[sendmail] = "${sbindir}/sendmail.postfix"
 ALTERNATIVE_LINK_NAME[sendmail] = "${sbindir}/sendmail"
+ALTERNATIVE_TARGET[usr-lib-sendmail] = "${sbindir}/sendmail.postfix"
+ALTERNATIVE_LINK_NAME[usr-lib-sendmail] = "/usr/lib/sendmail"
 
 ALTERNATIVE_PRIORITY = "120"
 
@@ -219,11 +223,6 @@ pkg_postinst_${PN} () {
         touch /etc/postfix/virtual_alias
         postmap /etc/postfix/virtual_alias
     else
-        if ${@'true' if 'linuxstdbase' in d.getVar('DISTROOVERRIDES', False) else 'false'}; then
-            # /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
         # This can fail depending on host setup
         if ! newaliases -C $D/etc/postfix/main.cf -oA$D/etc/aliases; then
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 2/2 esmtp: use alternatives to manage /usr/lib/sendmail

There are several packages which all provide /usr/lib/sendmail when lsb is enabled. So use alternative to manage it.

---
 meta-networking/recipes-support/esmtp/esmtp_1.2.bb | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
meta-networking/recipes-support/esmtp/esmtp_1.2.bb +5 -6
index 663161a..972d5aa 100644
@@ -18,11 +18,15 @@ EXTRA_OECONF = "--with-libesmtp=${STAGING_EXECPREFIXDIR}"
 
 inherit autotools update-alternatives
 
-ALTERNATIVE_${PN} += "sendmail mailq newaliases"
+ALTERNATIVE_${PN} = "sendmail mailq newaliases"
+# /usr/lib/sendmial is required by LSB core test
+ALTERNATIVE_${PN}_linuxstdbase = "sendmail mailq newaliases usr-lib-sendmail"
 ALTERNATIVE_TARGET[mailq] = "${bindir}/mailq"
 ALTERNATIVE_TARGET[newaliases] = "${bindir}/newaliases"
 ALTERNATIVE_LINK_NAME[sendmail] = "${sbindir}/sendmail"
 ALTERNATIVE_TARGET[sendmail] = "${bindir}/esmtp"
+ALTERNATIVE_LINK_NAME[usr-lib-sendmail] = "/usr/lib/sendmail"
+ALTERNATIVE_TARGET[usr-lib-sendmail] = "${bindir}/esmtp"
 
 ALTERNATIVE_PRIORITY = "10"
 
@@ -39,9 +43,4 @@ do_install_append() {
     rm -rf ${D}${libdir}
 }
 
-pkg_postinst_${PN}_linuxstdbase () {
-    # /usr/lib/sendmial is required by LSB core test
-    [ ! -L $D/usr/lib/sendmail ] && ln -sf ${sbindir}/sendmail $D/usr/lib/
-}
-
 FILES_${PN} += "${libdir}/"
Signature · 1 line
2.7.4