Installing software using the p2 director application

In addition to the "Software Updates" dialog, you can also perform provisioning operations from a command line or script. This is achieved using a tool called the director application. The director application is a command line tool for installing additional software or uninstalling software from an Eclipse-based product. This application is capable of provisioning a complete installation from scratch or simply extending your application. Depending on your needs, this application can be executed both inside and outside of the target product being provisioned.


Running inside the target application

In this mode, the provisioning operation happens from within the targeted product that you are provisioning. It is equivalent to starting up the targeted product and using the p2 UI to perform the equivalent operation.

This means that the target application has to be in a runnable state and has to contain the director application bundle. Also, since the target product will have run, cache files will have been created in the configuration folder (e.g. configuration/org.eclipse.osgi).

The following example shows the command line used to install CDT into the SDK.

   -application org.eclipse.equinox.p2.director 

Provisioning without running the target application

In this case the provisioning operation happens "outside" of the targeted product. The "targeted product" is *not* started. This allows one to both modify an existing installation and create a complete installation from scratch given proper metadata.

This also has the advantage that since the targeted product does not need to be started, the provisioning operation can be performed on any platform for any other platform (e.g. on my linux machine, one can add plug-ins to a windows-based target application).

Installing / uninstalling IUs into a target product

To install or uninstall something into an existing target product a few extra arguments than for the "inside" mode need to be set. These mostly consist in providing the provisioning operation the ID of the profile it needs to operate on, and where it is located on disk.

For example, if from a directory called "d:\builder" containing the builder, you want to install CDT into an existing SDK located into "d:\eclipse", you would use the following command line.

   -application org.eclipse.equinox.p2.director
   -tag AddCDT
   -destination d:/eclipse/
   -profile SDKProfile

Note that there is no need to describe the os/ws/arch of the platform being targeted because all this information is already available in the profile of the application in which we are provisioning.

Installing a complete product

The creation of a complete product using the director application only needs a few extra arguments compared to the previous example. Most of these consist of values used to initialize the profile in which the application will be provisioned.

The following example demonstrates how to create a linux/gtk installation of the Eclipse SDK provisioned into a folder called "d:\eclipse" using a director application located in "d:\builder".

   -application org.eclipse.equinox.p2.director
   -installIU org.eclipse.sdk.ide
   -tag InitialState
   -destination d:/eclipse/
   -profile SDKProfile
   -profileProperties org.eclipse.update.install.features=true
   -bundlepool d:/eclipse/
   -p2.os linux gtk
   -p2.arch x86

The -p2.* arguments describe the os/ws/arch that the provisioned product is targeting.

Arguments Description

While doing these operations, you can disable the automatic mirror selection mechanism by setting the VM argument eclipse.p2.mirrors to false.