From c723283340bd371db8375fff64f754d91cf56cfc Mon Sep 17 00:00:00 2001 From: "chao.an" Date: Wed, 1 Jul 2020 17:04:53 +0800 Subject: [PATCH] make/import: support import zip use relative path mkimport.sh failure if using relative path: $ ./tools/mkimport.sh -x ../incubator-nuttx/nuttx-export-9.1.0.zip unzip: cannot find or open ../incubator-nuttx/nuttx-export-9.1.0.zip, ../incubator-nuttx/nuttx-export-9.1.0.zip.zip or ../incubator-nuttx/nuttx-export-9.1.0.zip.ZIP. ERROR: unzip ../incubator-nuttx/nuttx-export-9.1.0.zip failed Change-Id: Ifc93c5e4dac95ec79a4e909b22ef646fbfe4484d Signed-off-by: chao.an --- tools/mkimport.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/mkimport.sh b/tools/mkimport.sh index 1c7a7a631..7ce19489e 100755 --- a/tools/mkimport.sh +++ b/tools/mkimport.sh @@ -114,19 +114,19 @@ rm -rf ${DALLDIRS} mkdir ${TMPDIR} || \ { echo "ERROR: Failed to create ${TMPDIR}"; exit 1; } +if [ "X${TGZ}" == "Xy" ]; then + tar zxf ${EXPORT} -C ${TMPDIR} || \ + { echo "ERROR: tar zxf ${EXPORT} failed"; exit 1; } +else + unzip ${EXPORT} -d ${TMPDIR} || \ + { echo "ERROR: unzip ${EXPORT} failed"; exit 1; } +fi + # Unpack the export package into the temporary directory cd ${TMPDIR} || \ { echo "ERROR: Failed to cd to ${TMPDIR}"; exit 1; } -if [ "X${TGZ}" == "Xy" ]; then - tar zxf ${EXPORT} || \ - { echo "ERROR: tar zxf ${EXPORT} failed"; exit 1; } -else - unzip ${EXPORT} || \ - { echo "ERROR: unzip ${EXPORT} failed"; exit 1; } -fi - EXPORTDIR=`ls` if [ -z "${EXPORTDIR}" ]; then