[Lunar-commits] <lunar> Even better: we DO use name-based content checking but we don't do full tar checkouts or uncompresses, and let magic do the work instead.

Auke Kok sofar at lunar-linux.org
Mon Jul 2 04:43:05 CEST 2012


commit 85836aceb96f92c922e37d9921c5c4a22211fe75
Author: Auke Kok <sofar at lunar-linux.org>
Date:   Tue Jun 7 15:25:57 2005 +0000

    Even better: we DO use name-based content checking but we don't do full tar checkouts or uncompresses, and let magic do the work instead.
---
 var/lib/lunar/functions/download.lunar |   25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/var/lib/lunar/functions/download.lunar b/var/lib/lunar/functions/download.lunar
index f7a4d2a..1218c2b 100644
--- a/var/lib/lunar/functions/download.lunar
+++ b/var/lib/lunar/functions/download.lunar
@@ -147,24 +147,25 @@ testpack () {
 		FILENAME=$SOURCE_CACHE/$1
 	fi
 	if [ -f "$FILENAME" ] ; then
+		FILEMAGIC=$(file -b $FILENAME)
 		case $FILENAME in
-			*.tar.bz2|*.tbz2|*.tbz|*.tgz|*.tar.gz)
-				tar tf $FILENAME > /dev/null 2>&1
+			*.bz2|*.BZ2)
+				echo $FILEMAGIC | grep -qw "bzip2"
 				;;
-			*.bz2)
-				bzip2 -tf $FILENAME > /dev/null 2>&1
+			*.gz|*.GZ|*.tgz|*.TGZ)
+				echo $FILEMAGIC | grep -qw "gzip"
 				;;
-			*.gz)
-				gzip -tf $FILENAME > /dev/null 2>&1
+			*.z|*.Z)
+				echo $FILEMAGIC | grep -qw "compress"
 				;;
-			*.Z|*.z)
-				gzip -tf $FILENAME > /dev/null 2>&1
+			*.zip|*.ZIP)
+				echo $FILEMAGIC | grep -qw "Zip"
 				;;
-			*.zip)
-				unzip -tq $FILENAME > /dev/null 2>&1
+			*.rpm|*.RPM)
+				echo $FILEMAGIC | grep -qw "RPM"
 				;;
-			*.rpm)
-				rpmunpack < $FILENAME | gzip -t > /dev/null 2>&1
+			*.CAB|*.cab)
+				echo $FILEMAGIC | grep -qw "Cabinet"
 				;;
 			*)
 				# we don't know how to handle this type of file


More information about the Lunar-commits mailing list