]> git.ipfire.org Git - people/stevee/network.git/commitdiff
copy: Automatically create target directory when copying files
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 23 Sep 2018 13:27:41 +0000 (15:27 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 23 Sep 2018 13:27:41 +0000 (15:27 +0200)
Fixes: #11663
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/functions/functions.util

index 0201d0286d41224b6275b833319150081428837c..58afa938a7249deb33dccf83a2f117802537d53c 100644 (file)
@@ -873,6 +873,11 @@ copy() {
                return ${EXIT_ERROR}
        fi
 
+       # Create destination directory if it doesn't exist, yet
+       if ! make_parent_directory "${dst}"; then
+               return ${EXIT_ERROR}
+       fi
+
        if ! fread "${src}" > "${dst}"; then
                log ERROR "Could not copy data from ${src} to ${dst}"
                return ${EXIT_ERROR}