From 9695fa7cca29518f36ac0261cf0bf18599731ca1 Mon Sep 17 00:00:00 2001 From: Manuel Canales Esparcia Date: Fri, 10 Aug 2007 21:24:02 +0000 Subject: [PATCH] =?UTF-8?q?Failsafe=20tests=20to=20be=20sure=20that=20we?= =?UTF-8?q?=20are=20deleting=20an=20existing=20unpacked=20sources=20direct?= =?UTF-8?q?ory.=20Thanks=20to=20Petr=20"Qaxi"=20Kl=C3=ADma=20for=20the=20r?= =?UTF-8?q?eport=20and=20patch.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BLFS/libs/scripts.xsl | 2 +- common/makefile-functions | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/BLFS/libs/scripts.xsl b/BLFS/libs/scripts.xsl index b959411..79d48b2 100644 --- a/BLFS/libs/scripts.xsl +++ b/BLFS/libs/scripts.xsl @@ -155,7 +155,7 @@ cd xc if [[ -e unpacked ]] ; then UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'` - rm -rf $UNPACKDIR + [[ -n $UNPACKDIR ]] && [[ -d $UNPACKDIR ]] && rm -rf $UNPACKDIR fi tar -xvf $PACKAGE > unpacked UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'` diff --git a/common/makefile-functions b/common/makefile-functions index d54938d..3f4f110 100644 --- a/common/makefile-functions +++ b/common/makefile-functions @@ -64,6 +64,7 @@ endef define remove_existing_dirs @PKG_PATH=`ls -t $(SRCSDIR)/$(1) | head -n1` && \ ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \ + test -n "$$ROOT" -a -d $(SRCSDIR)/$$ROOT && \ rm -rf $(SRCSDIR)/$$ROOT && \ rm -rf $(SRCSDIR)/$${ROOT%-*}-build endef @@ -71,6 +72,7 @@ endef define remove_existing_dirs2 @PKG_PATH=`ls -t $(SRC)/$(1) | head -n1` && \ ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \ + test -n "$$ROOT" -a -d $(SRC)/$$ROOT && \ rm -rf $(SRC)/$$ROOT && \ rm -rf $(SRC)/$${ROOT%-*}-build endef