Alternatives system 0.2.0 review

by on

Alternatives system is an implementation of a Debian alternatives system; a system that allows several programs with the same or simi

License: GPL (GNU General Public License)
File size: 0K
Developer: Stanislav Ievlev
0 stars award from

Alternatives system is an implementation of a Debian alternatives system; a system that allows several programs with the same or similar functions to be installed on a single system at the same time.

This implementation solves some problems and limitations of original implementation.

Alternatives architecture

General engine:

alternatives-auto - turn into auto mode some alternatives item
alternatives-manual - turn into manual mode some alternatives item
alternatives-update - update current state of alternatives symlinks

Special scripts for the packages:

alternatives-install - register new alternatives config, for use in %post package script
alternatives-uninstall - unregister some alternatives config, for use in %preun package script

ALT Linux specific:

alternatives-helper - helper script to use in package scripts
alternatives-upgrade - tool to upgrade from old config format (XML based) to new.


/usr/bin - all scripts live here
/etc/alternatives/packages.d - all package configs
/etc/alternatives/auto - symlinks to registered configs
/etc/alternatives/manual - list of alternatives in manual mode
/etc/alternatives/links - for internal use only, alternatives symlinks lives here
/usr/share/alternatives - directory with some helper functions and scripts

Original Debian alternatives implementation has some limitations and problems, so we (ALT Linux Team) rewrite this subsystem. What changes we have made?

You don't need to give special generic name for altenatives file. This name is autogenerated now.
This version is written in shell, awk and sed , so we reduce a number of dependencies, therefore, number of the packages in basesystem.
We use different update model. Original alternatives system maintains its own database, by creating/removing files in system. In our alternatives (rpm) packages contains it's configs and places them into generic directory during package installation. After package removal its config is automatically removed. It works like Debian menu subsystem, and it's more stable.
Now we have not any limitations for master-slave hieracly depth.
New alternatives system works with no groups, but with each item. You can turn into manual mode any available item. There are only one difference between master and slave: weight calculation algorithm. Slave alternative have same weight as a master alternative.
alternatives-update script corrects invalid manual alternatives, by switching them into auto mode. In original alternatives was situations with broken symlinks. Also new system doesn't create symlinks if target file does not exist. As a result, we also reduce number of broken symlinks.

Alternatives system 0.2.0 search tags