Installing software using the p2 director application

In addition to the "Software Updates" dialog it is possible to perform provisioning operations by running eclipse in a command line mode. This approach is more commonly referred to as the director application. The director application is a headless way of performing some of the p2 operations such as installing or uninstalling installable units. Given the appropriate metadata, 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.

Terminology


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.


  <targetProductFolder>/eclipse.exe 
   -application org.eclipse.equinox.p2.director.app.application 
   -metadataRepository http://download.eclipse.org/releases/ganymede/
   -artifactRepository http://download.eclipse.org/releases/ganymede/
   -installIU org.eclipse.cdt.feature.group
   -version <version>

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. It is important to note the presence of the VM args and set them properly.


   d:\builder\eclipse.exe
   -application org.eclipse.equinox.p2.director.app.application
   -metadataRepository http://download.eclipse.org/releases/ganymede/
   -artifactRepository http://download.eclipse.org/releases/ganymede/l
   -installIU org.eclipse.cdt.feature.group
   -version <version>
   -destination d:/eclipse/
   -profile SDKProfile
   
   -vmArgs
   -Declipse.p2.data.area=d:/eclipse/p2
   

Note that there is no need to describe the os/ws/arch of the platform being targeted because all this information is already made 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".


   d:\builder\eclipse.exe
   -application org.eclipse.equinox.p2.director.app.application
   -metadataRepository http://download.eclipse.org/eclipse/updates/3.4 
   -artifactRepository http://download.eclipse.org/eclipse/updates/3.4
   -installIU org.eclipse.sdk.ide
   -destination d:/eclipse/
   -profile SDKProfile
   -profileProperties org.eclipse.update.install.features=true
   -bundlepool d:/eclipse/
   -p2.os linux
   -p2.ws gtk
   -p2.arch x86
   -roaming
   
   -vmargs
   -Declipse.p2.data.area=d:/eclipse/p2

The -p2.* arguments describe the os/ws/arch that the provisioned product is targeting. Here again notice the presence of the -vmargs pointing at the eclipse data area for the installation being created.

Arguments Description