From 57c0b2088c266d7d9feed7a9a0ebe3a35f0494ef Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 11 Oct 2019 15:36:39 +0200 Subject: [PATCH] [unpackfs] Allow naming a non-directory for single files - this enables renaming files on copy --- src/modules/unpackfs/main.py | 6 +++--- src/modules/unpackfs/unpackfs.conf | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/modules/unpackfs/main.py b/src/modules/unpackfs/main.py index 3a64c6284..a9e6ea067 100644 --- a/src/modules/unpackfs/main.py +++ b/src/modules/unpackfs/main.py @@ -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"), diff --git a/src/modules/unpackfs/unpackfs.conf b/src/modules/unpackfs/unpackfs.conf index d994e351a..e81a90b0a 100644 --- a/src/modules/unpackfs/unpackfs.conf +++ b/src/modules/unpackfs/unpackfs.conf @@ -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"