[Lunar-commits] <lunar> bugfix hack: testpack is *THE* ideal location to use name-based checking of tarballs etc. This will catch virtually all 404 error pages and continue downloading from other URLs. afterwards sha1sum's are still checked but only prior to installation.

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


commit 7bdb00b1f743a8a8020cdc31dcb81563e111fd0f
Author: Auke Kok <sofar at lunar-linux.org>
Date:   Tue Jun 7 14:26:15 2005 +0000

    bugfix hack: testpack is *THE* ideal location to use name-based checking of tarballs etc. This will catch virtually all 404 error pages and continue downloading from other URLs. afterwards sha1sum's are still checked but only prior to installation.
---
 var/lib/lunar/functions/download.lunar |   19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/var/lib/lunar/functions/download.lunar b/var/lib/lunar/functions/download.lunar
index 49d5d46..f7a4d2a 100644
--- a/var/lib/lunar/functions/download.lunar
+++ b/var/lib/lunar/functions/download.lunar
@@ -147,26 +147,33 @@ testpack () {
 		FILENAME=$SOURCE_CACHE/$1
 	fi
 	if [ -f "$FILENAME" ] ; then
-		case $(file -b $FILENAME | cut -d ' ' -f1) in
-			bzip2)
+		case $FILENAME in
+			*.tar.bz2|*.tbz2|*.tbz|*.tgz|*.tar.gz)
+				tar tf $FILENAME > /dev/null 2>&1
+				;;
+			*.bz2)
 				bzip2 -tf $FILENAME > /dev/null 2>&1
 				;;
-			gzip)
+			*.gz)
 				gzip -tf $FILENAME > /dev/null 2>&1
 				;;
-			compress*)
+			*.Z|*.z)
 				gzip -tf $FILENAME > /dev/null 2>&1
 				;;
-			Zip)
+			*.zip)
 				unzip -tq $FILENAME > /dev/null 2>&1
 				;;
-			RPM)
+			*.rpm)
 				rpmunpack < $FILENAME | gzip -t > /dev/null 2>&1
 				;;
 			*)
+				# we don't know how to handle this type of file
 				true
 				;;
 	  	esac
+	else
+		# filename does not exist!
+		false
 	fi
 }
 


More information about the Lunar-commits mailing list