[Lunar-commits] r15281 - in lunar: branches/stable/var/lib/lunar/functions trunk/var/lib/lunar/functions
Auke Kok
sofar at lunar-linux.org
Tue Jun 7 15:25:59 UTC 2005
Author: sofar
Date: 2005-06-07 15:25:57 +0000 (Tue, 07 Jun 2005)
New Revision: 15281
Modified:
lunar/branches/stable/var/lib/lunar/functions/download.lunar
lunar/trunk/var/lib/lunar/functions/download.lunar
Log:
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.
Modified: lunar/branches/stable/var/lib/lunar/functions/download.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/download.lunar 2005-06-07 14:55:51 UTC (rev 15280)
+++ lunar/branches/stable/var/lib/lunar/functions/download.lunar 2005-06-07 15:25:57 UTC (rev 15281)
@@ -147,24 +147,25 @@
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
Modified: lunar/trunk/var/lib/lunar/functions/download.lunar
===================================================================
--- lunar/trunk/var/lib/lunar/functions/download.lunar 2005-06-07 14:55:51 UTC (rev 15280)
+++ lunar/trunk/var/lib/lunar/functions/download.lunar 2005-06-07 15:25:57 UTC (rev 15281)
@@ -147,26 +147,34 @@
FILENAME=$SOURCE_CACHE/$1
fi
if [ -f "$FILENAME" ] ; then
- case $(file -b $FILENAME | cut -d ' ' -f1) in
- bzip2)
- bzip2 -tf $FILENAME > /dev/null 2>&1
+ FILEMAGIC=$(file -b $FILENAME)
+ case $FILENAME in
+ *.bz2|*.BZ2)
+ echo $FILEMAGIC | grep -qw "bzip2"
;;
- gzip)
- gzip -tf $FILENAME > /dev/null 2>&1
+ *.gz|*.GZ|*.tgz|*.TGZ)
+ echo $FILEMAGIC | grep -qw "gzip"
;;
- compress*)
- gzip -tf $FILENAME > /dev/null 2>&1
+ *.z|*.Z)
+ echo $FILEMAGIC | grep -qw "compress"
;;
- Zip)
- unzip -tq $FILENAME > /dev/null 2>&1
+ *.zip|*.ZIP)
+ echo $FILEMAGIC | grep -qw "Zip"
;;
- RPM)
- rpmunpack < $FILENAME | gzip -t > /dev/null 2>&1
+ *.rpm|*.RPM)
+ echo $FILEMAGIC | grep -qw "RPM"
;;
+ *.CAB|*.cab)
+ echo $FILEMAGIC | grep -qw "Cabinet"
+ ;;
*)
+ # 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