2015-02-07 10:30:02 +00:00
|
|
|
================
|
|
|
|
package-installs
|
|
|
|
================
|
|
|
|
|
2014-04-24 20:51:24 +00:00
|
|
|
The package-installs element allows for a declarative method of installing and
|
2014-11-17 12:19:56 +00:00
|
|
|
uninstalling packages for an image build. This is done by creating a
|
|
|
|
package-installs.yaml or package-installs.json file in the element directory.
|
2014-04-24 20:51:24 +00:00
|
|
|
|
2016-02-18 16:57:07 +00:00
|
|
|
In order to work on Gentoo hosts you will need to manually install
|
|
|
|
`dev-python/pyyaml`.
|
2014-11-17 12:19:56 +00:00
|
|
|
|
2016-06-30 01:10:50 +00:00
|
|
|
example ``package-installs.yaml``
|
2014-11-17 12:19:56 +00:00
|
|
|
|
2016-06-30 01:10:50 +00:00
|
|
|
.. code-block:: YAML
|
2014-12-03 20:21:42 +00:00
|
|
|
|
2016-06-30 01:10:50 +00:00
|
|
|
libxml2:
|
|
|
|
grub2:
|
|
|
|
phase: pre-install.d
|
|
|
|
networkmanager:
|
|
|
|
uninstall: True
|
|
|
|
os-collect-config:
|
|
|
|
installtype: source
|
|
|
|
linux-image-amd64:
|
|
|
|
arch: amd64
|
|
|
|
dmidecode:
|
|
|
|
not-arch: ppc64, ppc64le
|
|
|
|
lshw:
|
|
|
|
arch: ppc64, ppc64le
|
2016-12-07 20:34:11 +00:00
|
|
|
python-dev:
|
|
|
|
dib_python_version: 2
|
|
|
|
python3-dev:
|
|
|
|
dib_python_version: 3
|
2020-03-18 19:39:17 +00:00
|
|
|
libssl-dev:
|
|
|
|
build-only: True
|
2018-11-20 23:20:34 +00:00
|
|
|
package-a:
|
|
|
|
when: DIB_USE_PACKAGE_A = 1
|
|
|
|
package-b:
|
|
|
|
when: DIB_USE_PACKAGE_A != 1
|
2016-06-30 01:10:50 +00:00
|
|
|
|
|
|
|
example package-installs.json
|
|
|
|
|
|
|
|
.. code-block:: json
|
2014-12-03 20:21:42 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
"libxml2": null,
|
|
|
|
"grub2": {"phase": "pre-install.d"},
|
|
|
|
"networkmanager": {"uninstall": true}
|
2015-01-21 00:45:48 +00:00
|
|
|
"os-collect-config": {"installtype": "source"}
|
2014-12-03 20:21:42 +00:00
|
|
|
}
|
2014-11-17 12:19:56 +00:00
|
|
|
|
|
|
|
|
2015-01-21 00:45:48 +00:00
|
|
|
Setting phase, uninstall, or installtype properties for a package overrides
|
|
|
|
the following default values::
|
2014-11-17 12:19:56 +00:00
|
|
|
|
2014-12-03 20:21:42 +00:00
|
|
|
phase: install.d
|
|
|
|
uninstall: False
|
2015-01-21 00:45:48 +00:00
|
|
|
installtype: * (Install package for all installtypes)
|
2015-04-23 00:48:51 +00:00
|
|
|
arch: * (Install package for all architectures)
|
2016-12-07 20:34:11 +00:00
|
|
|
dib_python_version: (2 or 3 depending on DIB_PYTHON_VERSION, see dib-python)
|
2015-01-21 00:45:48 +00:00
|
|
|
|
|
|
|
Setting the installtype property causes the package only to be installed if
|
|
|
|
the specified installtype would be used for the element. See the
|
|
|
|
diskimage-builder docs for more information on installtypes.
|
2014-11-17 12:19:56 +00:00
|
|
|
|
2020-03-18 19:39:17 +00:00
|
|
|
Setting ``build-only`` will cause the package to be added both to the
|
|
|
|
list of packages to be installed and to the list of packages to be
|
|
|
|
uninstalled. This allows expressing build-time dependencies that should
|
|
|
|
not end up in the final image.
|
|
|
|
|
2016-06-30 01:10:50 +00:00
|
|
|
The ``arch`` property is a comma-separated list of architectures to
|
|
|
|
install for. The ``not-arch`` is a comma-separated list of
|
|
|
|
architectures the package should be excluded from. Either ``arch`` or
|
|
|
|
``not-arch`` can be given for one package - not both. See
|
|
|
|
documentation about the ARCH variable for more information.
|
2014-11-17 12:19:56 +00:00
|
|
|
|
2018-11-20 23:20:34 +00:00
|
|
|
The ``when`` property is a simple ``=`` or ``!=`` match on a value in
|
|
|
|
an environment variable. If the given environment variable matches
|
|
|
|
the operation and value, the package is installed. If the variable is
|
|
|
|
not available in the environment, an exception is raised (thus
|
|
|
|
defaults will likely need to be provided in ``environment.d`` files or
|
|
|
|
similar for flags used here). For example, to install an extra
|
|
|
|
package when a feature is enabled::
|
|
|
|
|
|
|
|
package:
|
|
|
|
when: DIB_FEATURE_FLAG=1
|
|
|
|
|
|
|
|
To install ``package`` when ``DIB_FEATURE_FLAG=0`` but
|
|
|
|
``other_package`` when ``DIB_FEATURE_FLAG=1`` (i.e. toggle between two
|
|
|
|
packages), you can use something like::
|
|
|
|
|
|
|
|
package:
|
|
|
|
when: DIB_FEATURE_FLAG=0
|
|
|
|
other_package:
|
|
|
|
when: DIB_FEATURE_FLAG!=0
|
|
|
|
|
2014-11-17 12:19:56 +00:00
|
|
|
DEPRECATED: Adding a file under your elements pre-install.d, install.d, or
|
|
|
|
post-install.d directories called package-installs-<element-name> will cause
|
|
|
|
the list of packages in that file to be installed at the beginning of the
|
|
|
|
respective phase. If the package name in the file starts with a "-", then
|
|
|
|
that package will be removed at the end of the install.d phase.
|
2016-02-10 05:38:39 +00:00
|
|
|
|
|
|
|
Using post-install.d for cleanup
|
|
|
|
================================
|
|
|
|
|
|
|
|
Package removal is done in post-install.d at level 95. If you a
|
|
|
|
running cleanup functions before this, you need to be careful not
|
|
|
|
to clean out any temporary files relied upon by this element.
|
|
|
|
For this reason, generally post-install cleanup functions should
|
|
|
|
occupy the higher levels between 96 and 99.
|