diff --git a/elements/package-installs/README.rst b/elements/package-installs/README.rst index e3b6ad01..eb011e89 100644 --- a/elements/package-installs/README.rst +++ b/elements/package-installs/README.rst @@ -16,6 +16,8 @@ example package-installs.yaml:: uninstall: True os-collect-config: installtype: source + linux-image-amd64: + arch: amd64 example package-installs.json:: @@ -33,11 +35,15 @@ 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. +Setting the arch property causes the package only to be installed for the +specified target architecture. 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- will cause diff --git a/elements/package-installs/bin/package-installs-squash b/elements/package-installs/bin/package-installs-squash index 04611588..ff0cd62a 100755 --- a/elements/package-installs/bin/package-installs-squash +++ b/elements/package-installs/bin/package-installs-squash @@ -46,7 +46,14 @@ def collect_data(data, filename, element_name): # Filter out incorrect installtypes installtype = params.get('installtype', None) elem_installtype = get_element_installtype(element_name) - if installtype is None or installtype == elem_installtype: + valid_installtype = (installtype is None or + installtype == elem_installtype) + + # Filter out incorrect ARCH versions + arch = params.get('arch', None) + valid_arch = arch is None or arch == os.environ['ARCH'] + + if valid_installtype and valid_arch: data[phase][install].append((pkg_name, element_name)) return data