diskimage-builder/elements/package-installs
Ian Wienand f15550f9fe Special case dib-python in dib-lint
It seems that on Xenial, it does not take much to confuse "file" and
it's mime guessing such that it thinks some files are not python.

"package-installs-v2" is a good example, since it has an interpreter
"dib-python" that "file" doesn't know about, and no extension.  While
looking at this, I've added emacs vars here so it opens in python
mode.

Change-Id: I01994b08c5ad8987925f1eec4062f5b6ee72eb8f
2016-11-23 19:58:43 +11:00
..
bin Special case dib-python in dib-lint 2016-11-23 19:58:43 +11:00
extra-data.d Prioritize venv python on host 2016-02-28 20:50:02 -08:00
install.d Package installs defaults to tracing off 2015-12-20 00:03:51 +00:00
post-install.d Reorder the package-uninstall action 2016-02-11 18:30:05 -06:00
pre-install.d Package installs defaults to tracing off 2015-12-20 00:03:51 +00:00
README.rst package-installs: add list to arch and "not-arch" list 2016-07-01 21:31:59 +02:00
element-deps Add install-bin element 2016-05-13 11:52:23 +10:00

README.rst

package-installs

The package-installs element allows for a declarative method of installing and uninstalling packages for an image build. This is done by creating a package-installs.yaml or package-installs.json file in the element directory.

In order to work on Gentoo hosts you will need to manually install dev-python/pyyaml.

example package-installs.yaml

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

example package-installs.json

{
"libxml2": null,
"grub2": {"phase": "pre-install.d"},
"networkmanager": {"uninstall": true}
"os-collect-config": {"installtype": "source"}
}

Setting phase, uninstall, or installtype properties for a package overrides the following default values:

phase: install.d
uninstall: False
installtype: * (Install package for all installtypes)
arch: * (Install package for all architectures)

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.

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.

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.

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.