diff options
author | Manuel Canales Esparcia <manuel@linuxfromscratch.org> | 2007-08-10 21:24:02 +0000 |
---|---|---|
committer | Manuel Canales Esparcia <manuel@linuxfromscratch.org> | 2007-08-10 21:24:02 +0000 |
commit | 9695fa7cca29518f36ac0261cf0bf18599731ca1 (patch) | |
tree | c7a7cddf9b6478534d31aaf38076dd2eca489f9f | |
parent | 7c6c3556d2ccbd022fb141722fbe3d425b9f7bf7 (diff) |
Failsafe tests to be sure that we are deleting an existing unpacked sources directory.
Thanks to Petr "Qaxi" KlĂma for the report and patch.
-rw-r--r-- | BLFS/libs/scripts.xsl | 2 | ||||
-rw-r--r-- | common/makefile-functions | 2 |
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
</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 |