[unpackfs] Rename 'include' to 'condition'
Avoids ambiguity with 'exclude' which is passed to rsync.
This commit is contained in:
parent
6c33240ad0
commit
2bde5af133
@ -48,7 +48,7 @@ class UnpackEntry:
|
|||||||
:param destination:
|
:param destination:
|
||||||
"""
|
"""
|
||||||
__slots__ = ('source', 'sourcefs', 'destination', 'copied', 'total', 'exclude', 'excludeFile',
|
__slots__ = ('source', 'sourcefs', 'destination', 'copied', 'total', 'exclude', 'excludeFile',
|
||||||
'mountPoint', 'weight', 'include')
|
'mountPoint', 'weight', 'condition')
|
||||||
|
|
||||||
def __init__(self, source, sourcefs, destination):
|
def __init__(self, source, sourcefs, destination):
|
||||||
"""
|
"""
|
||||||
@ -71,7 +71,7 @@ class UnpackEntry:
|
|||||||
self.total = 0
|
self.total = 0
|
||||||
self.mountPoint = None
|
self.mountPoint = None
|
||||||
self.weight = 1
|
self.weight = 1
|
||||||
self.include = True
|
self.condition = True
|
||||||
|
|
||||||
def is_file(self):
|
def is_file(self):
|
||||||
return self.sourcefs == "file"
|
return self.sourcefs == "file"
|
||||||
@ -487,26 +487,26 @@ def run():
|
|||||||
sourcefs = entry["sourcefs"]
|
sourcefs = entry["sourcefs"]
|
||||||
destination = os.path.abspath(root_mount_point + entry["destination"])
|
destination = os.path.abspath(root_mount_point + entry["destination"])
|
||||||
|
|
||||||
include = entry.get("include", True)
|
condition = entry.get("condition", True)
|
||||||
if isinstance(include, bool):
|
if isinstance(condition, bool):
|
||||||
pass # 'include' is already True or False
|
pass # 'condition' is already True or False
|
||||||
elif isinstance(include, str):
|
elif isinstance(condition, str):
|
||||||
keys = include.split(".")
|
keys = condition.split(".")
|
||||||
gs_value = fetch_from_globalstorage(keys)
|
gs_value = fetch_from_globalstorage(keys)
|
||||||
if gs_value is None:
|
if gs_value is None:
|
||||||
libcalamares.utils.warning("Include key '{}' not found in global storage, assuming False".format(include))
|
libcalamares.utils.warning("Condition key '{}' not found in global storage, assuming False".format(condition))
|
||||||
include = False
|
condition = False
|
||||||
elif isinstance(gs_value, bool):
|
elif isinstance(gs_value, bool):
|
||||||
include = gs_value
|
condition = gs_value
|
||||||
else:
|
else:
|
||||||
libcalamares.utils.warning("Include key '{}' is not a boolean, assuming True".format(include))
|
libcalamares.utils.warning("Condition key '{}' is not a boolean, assuming True".format(condition))
|
||||||
include = True
|
condition = True
|
||||||
else:
|
else:
|
||||||
libcalamares.utils.warning("Invalid 'include' value '{}', assuming True".format(include))
|
libcalamares.utils.warning("Invalid 'condition' value '{}', assuming True".format(condition))
|
||||||
include = True
|
condition = True
|
||||||
|
|
||||||
if not include:
|
if not condition:
|
||||||
libcalamares.utils.debug("Skipping unpack of {} due to 'include' being False".format(source))
|
libcalamares.utils.debug("Skipping unpack of {} due to 'condition' being False".format(source))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not os.path.isdir(destination) and sourcefs != "file":
|
if not os.path.isdir(destination) and sourcefs != "file":
|
||||||
|
@ -87,18 +87,21 @@
|
|||||||
# copied, specify one single file (e.g. CHANGES) and a full pathname
|
# copied, specify one single file (e.g. CHANGES) and a full pathname
|
||||||
# for its destination name, as in the example below.
|
# for its destination name, as in the example below.
|
||||||
#
|
#
|
||||||
# It is also possible to dynamically include a source by passing a boolean
|
# It is also possible to dynamically (conditionally) unpack a source by passing a boolean
|
||||||
|
# value for *condition*. This may be true or false (constant) or name a globalstorage
|
||||||
|
# value. Use '.' to separate parts of a globalstorage name if it is nested.
|
||||||
|
#
|
||||||
# This is used in e.g. stacked squashfses, where the user can select a specific
|
# This is used in e.g. stacked squashfses, where the user can select a specific
|
||||||
# install type. The default is true.
|
# install type. The default value of *condition* is true.
|
||||||
#
|
#
|
||||||
# - source: ./example.minimal.sqfs
|
# - source: ./example.minimal.sqfs
|
||||||
# sourcefs: squashfs
|
# sourcefs: squashfs
|
||||||
# destination: ""
|
# destination: ""
|
||||||
# include: false
|
# condition: false
|
||||||
# - source: ./example.standard.sqfs
|
# - source: ./example.standard.sqfs
|
||||||
# sourcefs: squashfs
|
# sourcefs: squashfs
|
||||||
# destination: ""
|
# destination: ""
|
||||||
# include: exampleGlobalStorageVariable
|
# condition: exampleGlobalStorageVariable.subkey
|
||||||
|
|
||||||
unpack:
|
unpack:
|
||||||
- source: ../CHANGES
|
- source: ../CHANGES
|
||||||
|
@ -18,7 +18,7 @@ properties:
|
|||||||
excludeFile: { type: string }
|
excludeFile: { type: string }
|
||||||
exclude: { type: array, items: { type: string } }
|
exclude: { type: array, items: { type: string } }
|
||||||
weight: { type: integer, exclusiveMinimum: 0 }
|
weight: { type: integer, exclusiveMinimum: 0 }
|
||||||
include:
|
condition:
|
||||||
anyOf:
|
anyOf:
|
||||||
- type: boolean
|
- type: boolean
|
||||||
- type: string
|
- type: string
|
||||||
|
Loading…
Reference in New Issue
Block a user