update-alternatives - maintain symbolic links determining default commands.
Default implementation in PLD Linux is provided by alternatives package from chkconfig.
By default alternatives uses auto mode picking the “best” alternative.
TODO: how to enforce sysadmin preference
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
Requires: alternatives to runtime deps--install to setup the symlinks in package %post scriptlet.--slave option is optional and may be repeated, use if you wish to “group” alternatives%postun to remove alternative on package uninstall%{_mandir} path can be missing if %_excludedocs is set%{_mandir} path could be .gz compressed or not, it's currently solved with a glob: %{_mandir}/man1/phar%{ver_suffix}.1*