[unpackfs] Add settings per-item for exclude and excludeFile

- support excluding specific files / lists when rsyncing, in case
   the squashfs has more in it than you really want to copy over.
This commit is contained in:
Adriaan de Groot 2019-10-11 17:19:56 +02:00
parent 4552631086
commit 9d47716e5d
2 changed files with 20 additions and 1 deletions

View File

@ -49,7 +49,7 @@ class UnpackEntry:
:param sourcefs:
:param destination:
"""
__slots__ = ['source', 'sourcefs', 'destination', 'copied', 'total']
__slots__ = ['source', 'sourcefs', 'destination', 'copied', 'total', 'exclude', 'excludeFile']
def __init__(self, source, sourcefs, destination):
"""
@ -66,6 +66,8 @@ class UnpackEntry:
self.source = source
self.sourcefs = sourcefs
self.destination = destination
self.exclude = None
self.excludeFile = None
self.copied = 0
self.total = 0
@ -399,6 +401,12 @@ def run():
utils.debug(".. assuming that the previous targets will create that directory.")
unpack.append(UnpackEntry(source, sourcefs, destination))
# Optional settings
if entry.get("exclude", None):
unpack[-1].exclude = entry["exclude"]
if entry.get("excludeFile", None):
unpack[-1].excludeFile = entry["excludeFile"]
is_first = False
unpackop = UnpackOperation(unpack)

View File

@ -23,6 +23,13 @@
# empty string, which effectively is / (the root) of the target
# system.
#
# Each list item **optionally** can include the following attributes:
# - *exclude* is a list of values that is expanded into --exclude
# arguments for rsync (each entry in exclude gets its own --exclude).
# - *excludeFile* is a single file that is passed to rsync as an
# --exclude-file argument. This should be a full pathname
# inside the **host** filesystem.
#
# EXAMPLES
#
# Usually you list a filesystem image to unpack; you can use
@ -75,3 +82,7 @@ unpack:
- source: ../CHANGES
sourcefs: file
destination: "/tmp/changes.txt"
- source: src/qml/calamares/slideshow/
sourcefs: file
destination: "/tmp/"
exclude: [ "*.qmlc", "qmldir" ]