[unpackfs] Allow naming a non-directory for single files

- this enables renaming files on copy
This commit is contained in:
Adriaan de Groot 2019-10-11 15:36:39 +02:00
parent 4acf63fd9a
commit 57c0b2088c
2 changed files with 9 additions and 4 deletions

View File

@ -58,9 +58,9 @@ class UnpackEntry:
@p sourcefs is a type indication; "file" is special, as is
"squashfs".
@p destination is where the files from the source go. This is
**already** prefixed by rootMountPoint, so should be a
**already** prefixed by rootMountPoint, so should be a
valid absolute path within the host system.
The members copied and total are filled in by the copying process.
"""
self.source = source
@ -390,7 +390,7 @@ def run():
sourcefs = entry["sourcefs"]
destination = os.path.abspath(root_mount_point + entry["destination"])
if not os.path.isdir(destination):
if not os.path.isdir(destination) and sourcefs != "file":
utils.warning(("The destination \"{}\" in the target system is not a directory").format(destination))
if is_first:
return (_("Bad unsquash configuration"),

View File

@ -60,8 +60,13 @@
# - source: ../src/modules/dummycpp
# sourcefs: file
# destination: "/tmp/derp"
#
# The *destination* and *source* are handed off to rsync, so the semantics
# of trailing slashes apply. In order to *rename* a file as it is
# copied, specify one single file (e.g. CHANGES) and a full pathname
# for its destination name, as in the example below.
unpack:
- source: ../CHANGES
sourcefs: file
destination: "/tmp"
destination: "/tmp/changes.txt"