packages:alternatives
This is an old revision of the document!
alternatives
update-alternatives - maintain symbolic links determining default commands
switching alternative
By default alternatives
uses auto
mode picking the “best” alternative.
TODO: how to enforce sysadmin preference
integrating
from phar-php example:
Requires: alternatives ... %install ... # touch for ghost %{__rm} $RPM_BUILD_ROOT%{_bindir}/phar touch $RPM_BUILD_ROOT%{_bindir}/phar %post phar update-alternatives \ --install %{_bindir}/phar phar %{_bindir}/phar%{ver_suffix}.phar %{ver_suffix} \ --slave %{_mandir}/man1/phar.1 phar.1 %{_mandir}/man1/phar%{ver_suffix}.1* || : %postun phar if [ $1 -eq 0 ]; then update-alternatives --remove phar %{_bindir}/phar || : fi ... %files ... %ghost %{_bindir}/phar %ghost %{_mandir}/man1/phar.1
- add
Requires: alternatives
to runtime deps - the path must be ghost and regular file, otherwise rpm will complin about file-conflicts
- use
--install
to setup the symlinks in package%post
scriptlet. - the
--slave
option is optional and may be repeated, use if you wish to “group” alternatives - use proper
%postun
to remove alternative on package uninstall
packages/alternatives.1454304158.txt.gz · Last modified: 2016-02-01 06:22 by glen