commit:     3b8a53d497f26160a27c3288b89f0ae0a770e6df
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Fri Apr  3 04:12:15 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Fri Apr  3 07:47:45 2020 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=3b8a53d4

targets: Simplify copy_to_chroot()

Move the mkdir outside of the function, when it's actually needed. This
allows the destination argument to be a file rather than a directory.

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 targets/support/functions.sh | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/targets/support/functions.sh b/targets/support/functions.sh
index 5ab64726..5cbecb40 100755
--- a/targets/support/functions.sh
+++ b/targets/support/functions.sh
@@ -1,10 +1,9 @@
 #!/bin/bash
 
 copy_to_chroot() {
-       local src_file=$1
-       local dest_dir=${clst_chroot_path}${2:-/tmp}
-       mkdir -p ${dest_dir}
-       cp -pPR "${src_file}" "${dest_dir}"/
+       local src="${1}"
+       local dst="${clst_chroot_path}/${2:-/tmp}"
+       cp -pPR "${src}" "${dst}"
 }
 
 delete_from_chroot() {

Reply via email to