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.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Qi.Chen@windriver.com
2019-07-15 16:09:55 +08:00
committed by Khem Raj
parent c1ecd778ce
commit dbe4429e73
@@ -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