From 25850668bf38e75be4d72915eb630abb902e386d34ee7291c4a356e0a7fd8320 Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Fri, 18 Feb 2022 14:21:53 +0000 Subject: [PATCH] Accepting request 955839 from home:schubi2:branches:openSUSE:Factory - Use libalternatives instead of update-alternatives. OBS-URL: https://build.opensuse.org/request/show/955839 OBS-URL: https://build.opensuse.org/package/show/server:mail/mailx?expand=0&rev=70 --- mailx.changes | 5 +++++ mailx.spec | 62 +++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 63 insertions(+), 4 deletions(-) diff --git a/mailx.changes b/mailx.changes index ab97111..3b82cbd 100644 --- a/mailx.changes +++ b/mailx.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Feb 17 21:22:49 UTC 2022 - Stefan Schubert + +- Use libalternatives instead of update-alternatives. + ------------------------------------------------------------------- Tue Nov 23 12:41:51 UTC 2021 - Dr. Werner Fink diff --git a/mailx.spec b/mailx.spec index f0370fd..e96098d 100644 --- a/mailx.spec +++ b/mailx.spec @@ -1,7 +1,7 @@ # # spec file for package mailx # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,6 +16,12 @@ # +%if 0%{?suse_version} > 1500 +%bcond_without libalternatives +%else +%bcond_with libalternatives +%endif + Name: mailx BuildRequires: groff BuildRequires: krb5-devel @@ -25,8 +31,13 @@ BuildRequires: pkg-config BuildRequires: postfix BuildRequires: update-alternatives BuildRequires: pkgconfig(openssl) +%if %{with libalternatives} +BuildRequires: alts +Requires: alts +%else Requires(post): update-alternatives Requires(postun):update-alternatives +%endif URL: http://heirloom.sourceforge.net/mailx.html Provides: mail Recommends: smtp_daemon @@ -102,6 +113,8 @@ minor enhancements like the ability to set a "From:" address. %make_install PREFIX=/usr rm -rf %{buildroot}/bin mkdir %{buildroot}/bin +%if ! %{with libalternatives} + # create symlinks for update-alternatives mkdir -p %{buildroot}%{_sysconfdir}/alternatives %if !0%{?usrmerged} ln -sf %{_sysconfdir}/alternatives/binmail %{buildroot}/bin/mail @@ -118,9 +131,32 @@ minor enhancements like the ability to set a "From:" address. ln -sf %{_bindir}/mailx %{buildroot}%{_sysconfdir}/alternatives/mail ln -sf %{_mandir}/man1/mailx.1%{?ext_man} %{buildroot}%{_sysconfdir}/alternatives/Mail.1%{?ext_man} ln -sf %{_mandir}/man1/mailx.1%{?ext_man} %{buildroot}%{_sysconfdir}/alternatives/mail.1%{?ext_man} +%else + ln -sf %{_bindir}/alts %{buildroot}%{_bindir}/Mail +%if !0%{?usrmerged} + ln -sf %{_bindir}/alts %{buildroot}/bin/Mail +%endif + mkdir -p %{buildroot}%{_datadir}/libalternatives/Mail + cat > %{buildroot}%{_datadir}/libalternatives/Mail/20.conf < %{buildroot}%{_datadir}/libalternatives/mail/20.conf < 0 ] && [ -f %{_sbindir}/update-alternatives ] ; then + %{_sbindir}/update-alternatives --quiet --force --remove mail %{_bindir}/mailx +fi +%endif %files %defattr(-,root,root) @@ -143,17 +186,28 @@ fi %config /etc/mail.rc %if !0%{?usrmerged} /bin/mail +%endif +/usr/bin/Mail +/usr/bin/mail +%if ! 0%{with libalternatives} +%if !0%{?usrmerged} %ghost %config %{_sysconfdir}/alternatives/binmail %endif %ghost %config %{_sysconfdir}/alternatives/Mail %ghost %config %{_sysconfdir}/alternatives/mail %ghost %config %{_sysconfdir}/alternatives/Mail.1%{?ext_man} %ghost %config %{_sysconfdir}/alternatives/mail.1%{?ext_man} -/usr/bin/Mail -/usr/bin/mail -/usr/bin/mailx %doc %{_mandir}/man1/Mail.1.gz %doc %{_mandir}/man1/mail.1.gz +%else +%dir %{_datadir}/libalternatives +%dir %{_datadir}/libalternatives/mail +%dir %{_datadir}/libalternatives/Mail +%{_datadir}/libalternatives/Mail/20.conf +%{_datadir}/libalternatives/mail/20.conf +%endif + +/usr/bin/mailx %doc %{_mandir}/man1/mailx.1.gz %changelog