Skip to content

Commit

Permalink
rpm: fix alternatives configuration
Browse files Browse the repository at this point in the history
The previous calls were not correct causing scriptlet errors on installation
and removal:

- The installation scriptlet complained that it was unable to read "mailx"
- The `mailx` alternative did point to `/usr/bin/mq-sendmail` on removal.

Fixes: f31fdd2 ("rpm: add `/usr/sbin/sendmail` and `/usr/bin/mail` via the `alternatives` mechanism")
  • Loading branch information
FelixSchwarz committed Sep 15, 2024
1 parent f708308 commit 796d42e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions rpm/mailqueue-runner.spec
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,21 @@ pip install time-machine dotmap


%post
# set -x
restorecon %{_sysconfdir}/mailqueue-runner.conf
# using two different alternatives allows the administrator to use some other
# software alongside mailqueue-runner. For example "msmtp" provides a "sendmail"
# alternative so with two alternatives, we can still provide "/usr/bin/mail".
%{_sbindir}/alternatives --install %{_sbindir}/sendmail mta %{_bindir}/mq-sendmail 30
%{_sbindir}/alternatives --install %{_bindir}/mailx mailx %{_bindir}/mq-mail 30 \
--slave %{_bindir}/mail mail %{_bindir}/mq-mail
%{_sbindir}/alternatives --install %{_bindir}/mail mail %{_bindir}/mq-mail 30 \
--slave %{_bindir}/mailx mailx %{_bindir}/mq-mail


%postun
# set -x
if [ $1 -eq 0 ] ; then
%{_sbindir}/alternatives --remove mta %{_bindir}/mq-sendmail
%{_sbindir}/alternatives --remove mailx %{_bindir}/mq-sendmail
%{_sbindir}/alternatives --remove mail %{_bindir}/mq-mail
fi


Expand Down

0 comments on commit 796d42e

Please sign in to comment.