[Rpm-maint] [rpm-software-management/rpm] RFE: Alternatives handled by RPM (#993)

Stasiek Michalski notifications at github.com
Mon Jan 27 08:57:52 UTC 2020


Generally, the amount of magic that has to be implemented in spec to have the alternatives makes me sad. As openSUSE distributions implements a lot of alternatives, in every aspect of the system, this makes a lot of specs just look awfully busy for no reason. This could also be beneficial from the scriplets standpoint.

This is typically what goes into adding alternatives:
```sh
Requires(post): update-alternatives
Requires(postun): update-alternatives

%install
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
ln -s -f %{_sysconfdir}/alternatives/%{name} %{buildroot}%{link}

%post
update-alternatives --install %{link} %{name} %{path} %{priority}

%postun
if [ ! -f %{path} ] ; then
   update-alternatives --remove %{name} %{path}
fi

%files
%ghost %{_sysconfdir}/alternatives/%{name}
```

Which could be abbreviated with correct implementation into:
```sh
%files
%alternatives %{link} %{name} %{path} %{priority}
```

Which as it turns out, is way more readable ;)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/993#issuecomment-578650603
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20200127/ec2f781c/attachment.html>


More information about the Rpm-maint mailing list