Add installtype support to package-installs
Some packages should only be installed if a certain installtype is specified. Change-Id: Ia1a5af9ab4653e2646870ebd2d2db7e00a59305b
This commit is contained in:
parent
1162a3abe1
commit
3ff92589e1
@ -10,6 +10,8 @@ example package-installs.yaml::
|
|||||||
phase: pre-install.d
|
phase: pre-install.d
|
||||||
networkmanager:
|
networkmanager:
|
||||||
uninstall: True
|
uninstall: True
|
||||||
|
os-collect-config:
|
||||||
|
installtype: source
|
||||||
|
|
||||||
example package-installs.json::
|
example package-installs.json::
|
||||||
|
|
||||||
@ -17,14 +19,20 @@ example package-installs.json::
|
|||||||
"libxml2": null,
|
"libxml2": null,
|
||||||
"grub2": {"phase": "pre-install.d"},
|
"grub2": {"phase": "pre-install.d"},
|
||||||
"networkmanager": {"uninstall": true}
|
"networkmanager": {"uninstall": true}
|
||||||
|
"os-collect-config": {"installtype": "source"}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Setting phase or uninstall properties for a package overrides the following
|
Setting phase, uninstall, or installtype properties for a package overrides
|
||||||
default values::
|
the following default values::
|
||||||
|
|
||||||
phase: install.d
|
phase: install.d
|
||||||
uninstall: False
|
uninstall: False
|
||||||
|
installtype: * (Install package for all installtypes)
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
|
||||||
DEPRECATED: Adding a file under your elements pre-install.d, install.d, or
|
DEPRECATED: Adding a file under your elements pre-install.d, install.d, or
|
||||||
|
@ -23,6 +23,12 @@ import os
|
|||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
|
||||||
|
def get_element_installtype(element_name):
|
||||||
|
default = os.environ.get("DIB_DEFAULT_INSTALLTYPE", "source")
|
||||||
|
element_name.replace('-', '_')
|
||||||
|
return os.environ.get("DIB_INSTALLTYPE_%s" % element_name, default)
|
||||||
|
|
||||||
|
|
||||||
def collect_data(data, filename, element_name):
|
def collect_data(data, filename, element_name):
|
||||||
try:
|
try:
|
||||||
objs = json.load(open(filename))
|
objs = json.load(open(filename))
|
||||||
@ -36,6 +42,10 @@ def collect_data(data, filename, element_name):
|
|||||||
if 'uninstall' in params:
|
if 'uninstall' in params:
|
||||||
install = "uninstall"
|
install = "uninstall"
|
||||||
|
|
||||||
|
# Filter out incorrect installtypes
|
||||||
|
installtype = params.get('installtype', None)
|
||||||
|
elem_installtype = get_element_installtype(element_name)
|
||||||
|
if installtype is None or installtype == elem_installtype:
|
||||||
data[phase][install].append((pkg_name, element_name))
|
data[phase][install].append((pkg_name, element_name))
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user