Allow for optional items in unpackfs
This commit is contained in:
parent
714a085556
commit
560ad70aeb
@ -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', 'condition')
|
'mountPoint', 'weight', 'condition', 'optional')
|
||||||
|
|
||||||
def __init__(self, source, sourcefs, destination):
|
def __init__(self, source, sourcefs, destination):
|
||||||
"""
|
"""
|
||||||
@ -72,6 +72,7 @@ class UnpackEntry:
|
|||||||
self.mountPoint = None
|
self.mountPoint = None
|
||||||
self.weight = 1
|
self.weight = 1
|
||||||
self.condition = True
|
self.condition = True
|
||||||
|
self.optional = False
|
||||||
|
|
||||||
def is_file(self):
|
def is_file(self):
|
||||||
return self.sourcefs == "file"
|
return self.sourcefs == "file"
|
||||||
@ -461,6 +462,7 @@ def run():
|
|||||||
for entry in libcalamares.job.configuration["unpack"]:
|
for entry in libcalamares.job.configuration["unpack"]:
|
||||||
source = os.path.abspath(entry["source"])
|
source = os.path.abspath(entry["source"])
|
||||||
sourcefs = entry["sourcefs"]
|
sourcefs = entry["sourcefs"]
|
||||||
|
optional = entry.get("optional", False)
|
||||||
|
|
||||||
if sourcefs not in supported_filesystems:
|
if sourcefs not in supported_filesystems:
|
||||||
libcalamares.utils.warning("The filesystem for \"{}\" ({}) is not supported by your current kernel".format(source, sourcefs))
|
libcalamares.utils.warning("The filesystem for \"{}\" ({}) is not supported by your current kernel".format(source, sourcefs))
|
||||||
@ -468,9 +470,14 @@ def run():
|
|||||||
return (_("Bad unpackfs configuration"),
|
return (_("Bad unpackfs configuration"),
|
||||||
_("The filesystem for \"{}\" ({}) is not supported by your current kernel").format(source, sourcefs))
|
_("The filesystem for \"{}\" ({}) is not supported by your current kernel").format(source, sourcefs))
|
||||||
if not os.path.exists(source):
|
if not os.path.exists(source):
|
||||||
libcalamares.utils.warning("The source filesystem \"{}\" does not exist".format(source))
|
if optional:
|
||||||
return (_("Bad unpackfs configuration"),
|
libcalamares.utils.warning("The source filesystem \"{}\" does not exist but is marked as optional, skipping".format(source))
|
||||||
_("The source filesystem \"{}\" does not exist").format(source))
|
entry["condition"] = False
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
libcalamares.utils.warning("The source filesystem \"{}\" does not exist".format(source))
|
||||||
|
return (_("Bad unpackfs configuration"),
|
||||||
|
_("The source filesystem \"{}\" does not exist").format(source))
|
||||||
if sourcefs == "squashfs":
|
if sourcefs == "squashfs":
|
||||||
if shutil.which("unsquashfs") is None:
|
if shutil.which("unsquashfs") is None:
|
||||||
libcalamares.utils.warning("Failed to find unsquashfs")
|
libcalamares.utils.warning("Failed to find unsquashfs")
|
||||||
|
@ -102,6 +102,18 @@
|
|||||||
# sourcefs: squashfs
|
# sourcefs: squashfs
|
||||||
# destination: ""
|
# destination: ""
|
||||||
# condition: exampleGlobalStorageVariable.subkey
|
# condition: exampleGlobalStorageVariable.subkey
|
||||||
|
#
|
||||||
|
# You may also wish to include optional squashfses, which may not exist at certain times
|
||||||
|
# depending on your image tooling. If an optional squashfs is not found, it is simply
|
||||||
|
# skipped.
|
||||||
|
#
|
||||||
|
# - source: ./example.standard.sqfs
|
||||||
|
# sourcefs: squashfs
|
||||||
|
# destination: ""
|
||||||
|
# - source: ./example.extras.sqfs
|
||||||
|
# sourcefs: squashfs
|
||||||
|
# destination: ""
|
||||||
|
# optional: true
|
||||||
|
|
||||||
unpack:
|
unpack:
|
||||||
- source: ../CHANGES
|
- source: ../CHANGES
|
||||||
|
@ -18,6 +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 }
|
||||||
|
optional: { type: boolean }
|
||||||
condition:
|
condition:
|
||||||
anyOf:
|
anyOf:
|
||||||
- type: boolean
|
- type: boolean
|
||||||
|
Loading…
Reference in New Issue
Block a user