Syntax
This page described the GAR integration of alternatives in a condensed way. For details on how alternatives work and what the parameters mean see the explanation on "Alternatives" in the OpenCSW wiki.
There is one alternative per line which translates more or less directly in an invocation of alternatives --install.
<link> <name> <real-path> <priority> [<slave-link> <slave-name> <slave-real-path>]*
- <link> is the link to be switched in the filesystem between all <real-path> with the same <name> in other alternatives.
- <name> is the name of the alternative. It is used internally by the alternative mechanism to find all alternative pathes for a link.
- <real-path> is the path to an existing file. It is a possible alternative for <link> to point to.
- <priority> is a number indicating the absolute priority of this alternative. If in automatic mode the alternatives with the highest priority gets linked.
- The slave-parameters are changed in the same way whenever the master link is changed.
Adding one alternative to one package
Use this when one package provides a single alternative for a thing and another package in another GAR Makefile another alternative.
ALTERNATIVE = $(bindir)/xpdf xpdf $(bindir)/xpdf.poppler 100
This adds one alternative $(bindir)/xpdf.poppler for the file $(bindir)/xpdf to xpdf with the priority 100.
Adding multiple alternatives to one package
Use this when one package provides multiple alternatives for the same thing.
ALTERNATIVES = 1.6 1.7 ALTERNATIVE_1.6 = $(bindir)/automake automake $(bindir)/automake-1.6 60 ALTERNATIVE_1.6 += $(bindir)/aclocal aclocal $(bindir)/aclocal-1.6 ALTERNATIVE_1.7 = $(bindir)/automake automake $(bindir)/automake-1.7 70 ALTERNATIVE_1.7 += $(bindir)/aclocal aclocal $(bindir)/aclocal-1.7
Adding alternatives to multiple packages
Use this when multiple packages are build in one GAR Makefile and each package provides one alternative for the same thing.
ALTERNATIVES_CSWmutt-ncurses = ncurses ALTERNATIVES_CSWmutt-slang = slang ALTERNATIVE_ncurses = $(bindir)/mutt mutt $(bindir)/mutt-ncurses 100 ALTERNATIVE_slang = $(bindir)/mutt mutt $(bindir)/mutt-slang 200
Informing the user with postinstall message
POSTMSG = $(docdir)/$(CATALOGNAME)/CSWtcpwrap.postmsg
DISTFILES +=$(notdir $(POSTMSG)
...
post-merge:
ginstall -d $(PKGROOT)$(dir $(POSTMSG))
ginstall $(WORKDIR)/$(notdir $(POSTMSG)) $(PKGROOT)$(POSTMSG)
This is what typically gets displayed after package install, courtesy of the following file: file/CSWxxx.postmsg:
There are now two versions of tcpwrappers on the system installed: * libwrap-std.so.1 The "standard" tcp wrapper library * libwrap-ext.so.1 The "extended" tcp wrapper library You can easily select between the versions with the alternatives(8) system by executing /opt/csw/sbin/alternatives --config tcpwrappers See http://wiki.opencsw.org/alternatives-package for further details.
