From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 1746F138200 for ; Sun, 30 Sep 2012 22:30:06 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4C71B21C08F; Sun, 30 Sep 2012 22:29:53 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 1E7A321C08F for ; Sun, 30 Sep 2012 22:29:53 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7D21133D753 for ; Sun, 30 Sep 2012 22:29:52 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 437F7E544B for ; Sun, 30 Sep 2012 22:29:51 +0000 (UTC) From: "Jorge Manuel B. S. Vicetto" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Jorge Manuel B. S. Vicetto" Message-ID: <1349044106.17b34223a4afc1f070ac2fb9bdfb51e47c03db61.jmbsvicetto@gentoo> Subject: [gentoo-commits] proj/catalyst:master commit in: targets/support/ X-VCS-Repository: proj/catalyst X-VCS-Files: targets/support/functions.sh X-VCS-Directories: targets/support/ X-VCS-Committer: jmbsvicetto X-VCS-Committer-Name: Jorge Manuel B. S. Vicetto X-VCS-Revision: 17b34223a4afc1f070ac2fb9bdfb51e47c03db61 X-VCS-Branch: master Date: Sun, 30 Sep 2012 22:29:51 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: e562c5d1-525e-446f-b24c-d84fd47f9438 X-Archives-Hash: b0c79fc88bbe46dc81d9179964900588 commit: 17b34223a4afc1f070ac2fb9bdfb51e47c03db61 Author: Jorge Manuel B. S. Vicetto (jmbsvicetto) gentoo org> AuthorDate: Sun Sep 30 22:27:29 2012 +0000 Commit: Jorge Manuel B. S. Vicetto gentoo org> CommitDate: Sun Sep 30 22:28:26 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=17b34223 Make sure we have ${destdir} on copy_to_chroot and simplify exec_in_chroot. --- targets/support/functions.sh | 42 ++++++++++++++---------------------------- 1 files changed, 14 insertions(+), 28 deletions(-) diff --git a/targets/support/functions.sh b/targets/support/functions.sh index 4ccad4c..60ad249 100644 --- a/targets/support/functions.sh +++ b/targets/support/functions.sh @@ -1,6 +1,7 @@ copy_to_chroot() { local src_file=$1 local dest_dir=${clst_chroot_path}${2:-/tmp} + mkdir -p ${dest_dir} echo "copying ${src_file##*/} to ${dest_dir}" cp -pPR "${src_file}" "${dest_dir}"/ } @@ -18,34 +19,19 @@ exec_in_chroot(){ # copies the file to the /tmp directory of the chroot # and executes it. local file_name=$(basename ${1}) - local subdir=${2#/} - - if [ "${subdir}" != "" ] - then - copy_to_chroot ${1} ${subdir}/tmp/ - chroot_path=${clst_chroot_path}${subdir} - copy_to_chroot ${clst_sharedir}/targets/support/chroot-functions.sh \ - ${subdir}/tmp/ - echo "Running ${file_name} in chroot ${chroot_path}" - ${clst_CHROOT} ${chroot_path} /tmp/${file_name} || exit 1 - else - copy_to_chroot ${1} tmp/ - chroot_path=${clst_chroot_path} - copy_to_chroot ${clst_sharedir}/targets/support/chroot-functions.sh \ - tmp/ - echo "Running ${file_name} in chroot ${chroot_path}" - ${clst_CHROOT} ${chroot_path}/ /tmp/${file_name} || exit 1 - fi - - rm -f ${chroot_path}/tmp/${file_name} - if [ "${subdir}" != "" ] - then - delete_from_chroot ${subdir}/tmp/${file_name} - delete_from_chroot ${subdir}/tmp/chroot-functions.sh - else - delete_from_chroot tmp/chroot-functions.sh - delete_from_chroot tmp/${file_name} - fi + local subdir=${2} + local destdir=${subdir}/tmp + destdir=${destdir#/} + + copy_to_chroot ${1} ${destdir} + chroot_path=${clst_chroot_path}${subdir} + copy_to_chroot ${clst_sharedir}/targets/support/chroot-functions.sh \ + ${destdir} + echo "Running ${file_name} in chroot ${chroot_path}" + ${clst_CHROOT} ${chroot_path} ${destdir}/${file_name} || exit 1 + + delete_from_chroot ${destdir}/${file_name} + delete_from_chroot ${destdir}/chroot-functions.sh } #return codes