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
- Director application: the application performing p2
operations such as install or uninstall. This application is provided
by the org.eclipse.equinox.p2.director.app bundle.
- Provisioning operation: an operation installing,
uninstalling features.
- Target product: the installation targeted by the
provisioning operation.
- Builder: an eclipse based application containing the
director application bundle and its dependents.
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
-
-application org.eclipse.equinox.p2.director
-
The application ID.
- -metadatarepository | metadatarepositories | -m <comma separated list>
-
A list of URLs denoting meta-data repositories.
- -artifactrepository | artifactrepositories | -a <comma separated list>
-
A list of URLs denoting artifact repositories.
- -repository | repositories | -r <comma separated list>
-
A list of URLs denoting co-located meta-data and artifact repositories.
- -installIU | -installIUs | -i <comma separated list>
-
Installs the listed IUs. Each entry in the list is in the form <id> [ '/' <version> ].
- -uninstallIU | -uninstallIUs | -u <comma separated list>
-
Uninstalls the listed IUs. Each entry in the list is in the form <id> [ '/' <version> ].
- -revert <comma separated list>
-
Revert the installation to a previous state [ the number representing the previous state of the profile as found in p2/org.eclipse.equinox.p2.engine/<profileId>/ ].
- -purgeHistory
-
Remove the history of the profile registry.
- -destination | -d <path>
-
The folder in which the targeted product is located.
- -list | -l [ <comma separated list> ]
-
Lists all IUs found in the given repositories. IUs can optionally be listed. Each entry in the list is in the form <id> [ '/' <version> ].
- -listTags
-
List the tags available
- -listInstalledRoots | -lir
-
Lists all root IUs found in the given profile. Each entry in the list is in the form <id> [ '/' <version> ].
- -listFormat | -lf <list format string>
-
Formats the list of IUs according to the given string. Use ${property} for variable parts, e.g. ${org.eclipse.equinox.p2.name} for the IU's name. ID and version of an IU are available through ${id} and ${version}.
- -profile | -p <name>
-
Defines what profile to use for the actions.
- -profileproperties <comma separated list>
-
A list of properties in the form key=value pairs. Effective only when a new profile is created.
- -iuProfileproperties <path>
-
Path to a properties file containing a list of IU profile properties to set.
- -flavor | -f <name>
-
Defines what flavor to use for a newly created profile.
- -bundlepool | -b <path>
-
The location where the plug-ins and features will be stored. Effective only when a new profile is created.
- -p2.os
-
The OS to use when the profile is created.
- -p2.ws
-
The windowing system to use when the profile is created.
- -p2.arch
-
The architecture to use when the profile is created.
- -p2.nl
-
The language to use when the profile is created.
- -roaming
-
Indicates that the product resulting from the installation can be moved. Effective only when a new profile is created.
- -shared | -s [ <path> ]
-
Use a shared location for the install. The <path> defaults to ${user.home}/.p2
- -tag <name>
-
Tag the provisioning operation for easy referencing when reverting.
- -verifyOnly
-
Only verify that the actions can be performed. Don't actually install or remove anything.
- -downloadOnly
-
Only download the artifacts.
- -followReferences
-
Follow repository references.
- -verboseTrust | -vt
-
Whether to print detailed information about the content trust.
- -trustSignedContentOnly | -tsco
-
Whether to trust each artifact only if it is jar-signed or PGP-signed.
- -trustedAuthorities | -ta <comma separated list>
-
The authorities from which repository content, including repository metadata, is trusted. An empty value will reject all remote connections.
- -trustedPGPKeys | -tk <comma separated list>
-
The fingerprints of PGP keys to trust as signers of artifacts. An empty value will reject all PGP keys.
- -trustedCertificates | -tc <comma separated list>
-
The SHA-256 'fingerprints' of unanchored certficates to trust as signers of artifacts. An empty value will reject all unanchored certificates.
- -addJREIU
-
Include a default JRE installable unit as an extra IU. This IU satisfies JRE dependencies in the case that the content metadata does not otherwise provide an IU for that purpose.
- -help | -h | -?
-
Prints this command line help information.
While doing these operations, you can disable the automatic mirror selection mechanism by setting the VM argument eclipse.p2.mirrors to false.