packages:alternatives
alternatives
update-alternatives - maintain symbolic links determining default commands.
Default implementation in PLD Linux is provided by alternatives package from chkconfig.
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: alternativesto runtime deps - the path must be ghost and regular file, otherwise rpm will complin about file-conflicts
- use
--installto setup the symlinks in package%postscriptlet. - the
--slaveoption is optional and may be repeated, use if you wish to “group” alternatives - use proper
%postunto remove alternative on package uninstall
Currently it remains unclear how to handle optional files, as for above example:
%{_mandir}path can be missing if%_excludedocsis set%{_mandir}path could be.gzcompressed or not, it's currently solved with a glob:%{_mandir}/man1/phar%{ver_suffix}.1*
packages/alternatives.txt · Last modified: 2016-02-01 06:25 by glen