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
@@ -114,19 +114,19 @@ rm -rf ${DALLDIRS}
mkdir ${TMPDIR} || \
{ echo "ERROR: Failed to create ${TMPDIR}"; exit 1; }
-# 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} || \
+ tar zxf ${EXPORT} -C ${TMPDIR} || \
{ echo "ERROR: tar zxf ${EXPORT} failed"; exit 1; }
else
- unzip ${EXPORT} || \
+ 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; }
+
EXPORTDIR=`ls`
if [ -z "${EXPORTDIR}" ]; then
