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.

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>/eclipsec.exe
   -application org.eclipse.equinox.p2.director
   -repository https://download.eclipse.org/releases/helios/
   -installIU org.eclipse.cdt.feature.group/<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.


   d:\builder\eclipsec.exe
   -application org.eclipse.equinox.p2.director
   -repository https://download.eclipse.org/releases/helios/
   -installIU org.eclipse.cdt.feature.group
   -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".


   d:\builder\eclipsec.exe
   -application org.eclipse.equinox.p2.director
   -repository https://download.eclipse.org/eclipse/updates/3.6
   -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
   -p2.ws gtk
   -p2.arch x86
   -roaming
 

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

Installing a complete product for macOS

The creation of a complete product for the macOS Operating System requires that the destination folder end with ".app/" as in the following example.

 
   d:\builder\eclipsec.exe
   -nosplash
   -application org.eclipse.equinox.p2.director
   -repository https://download.eclipse.org/releases/mars
   -installIU org.eclipse.sdk.ide
   -tag InitialState
   -destination d:/eclipse/MyApp.app/
   -profile SDKProfile
   -profileProperties org.eclipse.update.install.features=true
   -p2.os macosx
   -p2.ws cocoa
   -p2.arch x86_64
   -roaming
 

For a macOS App product, you may also want to edit the Info.plist file, such as to change CFBundleName to the name of your product.

Arguments Description

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