Skip to contentSkip to conversation

postfix: add link file /usr/lib/sendmail

PATCH New Kai Kang 1 participant 2 messages Mar 10, 2015

lore
Share & tools
lore

Kai Kang

author
#0 lore raw

PATCH 1/2 postfix: add link file /usr/lib/sendmail

Link file /usr/lib/sendmail points to /usr/sbin/sendmail is required by LSB core test according to Linux FHS[Ref2]: "For historical reasons, /usr/lib/sendmail must be a symbolic link to /usr/sbin/sendmail if the latter exists."

The linke file was provided by package lsb before, but should be provided by packages which provides command sendmail such as msmtp, postfix and esmtp etc.

Refs:
1 http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/normativerefs.html#STD.
2 http://www.pathname.com/fhs/pub/fhs-2.3.html#SPECIFICOPTIONS13

---
 meta-networking/recipes-daemons/postfix/postfix.inc | 5 +++++
 1 file changed, 5 insertions(+)
meta-networking/recipes-daemons/postfix/postfix.inc +5 -0
index a6909e9..1136bd2 100644
@@ -230,6 +230,11 @@ pkg_postinst_${PN} () {
         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
+
+        if ${@'true' if 'linuxstdbase' in d.getVar('DISTROOVERRIDES') else 'false'}; then
+            # /usr/lib/sendmial is required by LSB core test
+            [ ! -L $D/usr/lib/sendmail ] && ln -sf ${sbindir}/sendmail $D/usr/lib/
+        fi
     fi
 }
 
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 2/2 esmtp: update sendmail link files

esmtp use 'sbinsendmail' to define alternative ${sbindir}/sendmail, but other packages msmtp and postfix use 'sendmail'. When remove esmtp, it removes ${sbindir}/sendmail even msmtp or postfix is installed which has alternative ${sbindir}/sendmail.

Make esmtp use 'sendmail' too to fix this issue.

Remove ${libdir}/sendmail which is only used by LSB core test for historical reasons. And only create link file with fixed path /usr/lib/sendmail for LSB images even for 64 bits system.

---
 meta-networking/recipes-support/esmtp/esmtp_1.2.bb | 24 +++++++++++-----------
 1 file changed, 12 insertions(+), 12 deletions(-)
meta-networking/recipes-support/esmtp/esmtp_1.2.bb +12 -12
index 69bdaf9..917dc8b 100644
@@ -18,23 +18,23 @@ EXTRA_OECONF = "--with-libesmtp=${STAGING_EXECPREFIXDIR}"
 
 inherit autotools update-alternatives
 
-ALTERNATIVE_${PN} = "sbinsendmail libsendmail"
+ALTERNATIVE_${PN} = "sendmail"
 
-ALTERNATIVE_LINK_NAME[sbinsendmail] = "${sbindir}/sendmail"
-ALTERNATIVE_TARGET[sbinsendmail] = "${bindir}/esmtp"
-ALTERNATIVE_LINK_NAME[libsendmail] = "${libdir}/sendmail"
-ALTERNATIVE_TARGET[libsendmail] = "${bindir}/esmtp"
+ALTERNATIVE_LINK_NAME[sendmail] = "${sbindir}/sendmail"
+ALTERNATIVE_TARGET[sendmail] = "${bindir}/esmtp"
 ALTERNATIVE_PRIORITY = "10"
 
 SRC_URI[md5sum] = "79a9c1f9023d53f35bb82bf446150a72"
 SRC_URI[sha256sum] = "a0d26931bf731f97514da266d079d8bc7d73c65b3499ed080576ab606b21c0ce"
 
-FILES_${PN} += "${libdir}/"
+do_install_append() {
+    # only one file /usr/lib/sendmail in ${D}${libdir}
+    rm -rf ${D}${libdir}
+}
 
-# The sysroot/${libdir}/sendmail conflicts with lsb's, and it's a
-# symlink to ${bindir}/esmtp which is meaningless for sysroot, so
-# remove it.
-SYSROOT_PREPROCESS_FUNCS += "remove_sysroot_sendmail"
-remove_sysroot_sendmail() {
-    rm -r "${SYSROOT_DESTDIR}${libdir}/sendmail"
+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
1.9.1