aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--BLFS/libs/scripts.xsl2
-rw-r--r--common/makefile-functions2
2 files changed, 3 insertions, 1 deletions
diff --git a/BLFS/libs/scripts.xsl b/BLFS/libs/scripts.xsl
index b9594117f6..79d48b2d4c 100644
--- a/BLFS/libs/scripts.xsl
+++ b/BLFS/libs/scripts.xsl
@@ -155,7 +155,7 @@ cd xc&#xA;</xsl:text>
<xsl:text>
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 d54938d94f..3f4f110b15 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