Fedora10PackagingNBAlternatives
Fedora 10 - Packaging of the NetBeans - Alternatives
Contents |
Overview
}}commentbox Note: The alternatives system is a reimplementation of the Debian alternatives system. It was rewritten primarily to remove the dependence on perl; it is intended to be a drop in replacement for Debian’s update-dependencies script.}} The Fedora distribution includes very useful the Alternatives System. The system is supported by the utility /usr/sbin/alternatives (AKA update-alternatives). The alternatives - maintain symbolic links determining default commands.
The NetBeans IDE assumes that several versions of the IDE can be installed on a system at the same time. Also, Linux native packages of the NetBeans provide facility to run the NetBeans IDE from the command line. The Alternatives System give ability for a user to make choice of the IDE version that will be started after execution of the command netbeans.
Since netbeans.spec, revision 2.fc10 the Alternatives System is used in the NetBeans RPM for Fedora as a start point to run the NetBeans IDE from the command line.
Implementation
The netbeans.spec contains the following code:
%define __alternatives %{_sbindir}/alternatives
%define nb_ netbeans
%define nb_ver 6.1
%define nb_alt_priority 610
%define nb_home %{_datadir}/%{nb_}
%define nb_dir %{nb_home}/%{nb_ver}
%define nb_bin_dir %{nb_dir}/bin
%define nb_launcher %{nb_bin_dir}/netbeans
...
%post
%{__alternatives} --install %{_bindir}/%{nb_} %{nb_} %{nb_launcher} %{nb_alt_priority}
%preun
if ["$1"="0" ]; then
%{__alternatives} --remove %{nb_} %{nb_launcher}
fi
Usage
Run the NetBeans IDE
The netbeans link is placed in the directory %{_bindir} (i.e. /usr/bin). Usually, this directory in the path ($PATH) by default. To start the NetBeans IDE from the command line simply use the command
$ netbeans
To get help use the command
$ netbeans --help
Display Alternatives
$ su - # alternatives --display netbeans netbeans - status is auto. link currently points to /usr/share/netbeans/6.1/bin/netbeans /usr/share/netbeans/6.1/bin/netbeans - priority 610 Current `best' version is /usr/share/netbeans/6.1/bin/netbeans.
Info about the Alternatives System
$ man alternatives

