commit:     2a02561c318d54cc2333ddb0815f7403387825eb
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Fri Apr  3 05:28:58 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=2a02561c

targets: Simplify exec_in_chroot()

Inline the destdir variable since it is a constant, and since /tmp is
the default destination in copy_to_chroot() we can remove it.

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

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

diff --git a/targets/support/functions.sh b/targets/support/functions.sh
index 5cbecb40..1268b0d1 100755
--- a/targets/support/functions.sh
+++ b/targets/support/functions.sh
@@ -15,23 +15,21 @@ delete_from_chroot() {
 # and executes it.
 exec_in_chroot() {
        local file_name=$(basename ${1})
-       local destdir="/tmp"
 
-       copy_to_chroot ${1} ${destdir}
-       copy_to_chroot ${clst_shdir}/support/chroot-functions.sh \
-               ${destdir}
+       copy_to_chroot ${1}
+       copy_to_chroot ${clst_shdir}/support/chroot-functions.sh
 
        chroot_path=${clst_chroot_path}
 
        # Ensure the file has the executable bit set
-       chmod +x ${chroot_path}/${destdir}/${file_name}
+       chmod +x ${chroot_path}/tmp/${file_name}
 
        echo "Running ${file_name} in chroot:"
-       echo "    ${clst_CHROOT} ${chroot_path} ${destdir}/${file_name}"
-       ${clst_CHROOT} ${chroot_path} .${destdir}/${file_name} || exit 1
+       echo "    ${clst_CHROOT} ${chroot_path} /tmp/${file_name}"
+       ${clst_CHROOT} "${chroot_path}" "/tmp/${file_name}" || exit 1
 
-       delete_from_chroot ${destdir}/${file_name}
-       delete_from_chroot ${destdir}/chroot-functions.sh
+       delete_from_chroot /tmp/${file_name}
+       delete_from_chroot /tmp/chroot-functions.sh
 }
 
 #return codes

Reply via email to