Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=1237d6f3133a801d6842cd4ae8726d472c54e2f7
commit 1237d6f3133a801d6842cd4ae8726d472c54e2f7 Author: Miklos Vajna <vmik...@frugalware.org> Date: Sat May 8 12:55:33 2010 +0200 scripts: use file -i to determine if we need to call bzip2 --test or xz --test diff --git a/scripts/gensync b/scripts/gensync index adab30a..fc5136d 100755 --- a/scripts/gensync +++ b/scripts/gensync @@ -64,7 +64,14 @@ CHROOT=1 get_sha1checksum() { if [ -f $pkgfile ]; then - bzip2 --test $pkgfile || die "corrupted package: $pkgfile" + format=`file -i $pkgfile |sed 's/.*: \(.*\);.*/\1/'` + if [ "$format" == "application/x-bzip2" ]; then + bzip2 --test $pkgfile || die "corrupted bzip2 package: $pkgfile" + elif [ "$format" == "application/x-xz" ]; then + xz --test $pkgfile || die "corrupted xz package: $pkgfile" + else + die "unsupported package format: $format" + fi sha1line=`sha1sum $pkgfile` [ ! -z "$sha1line" ] && pkgsha1sum=${sha1line% *} echo $pkgsha1sum diff --git a/scripts/updatesync b/scripts/updatesync index 1881a7b..324866a 100755 --- a/scripts/updatesync +++ b/scripts/updatesync @@ -65,7 +65,14 @@ CHROOT=1 get_sha1checksum() { if [ -f $pkgfile ]; then - bzip2 --test $pkgfile || die "corrupted package: $pkgfile" + format=`file -i $pkgfile |sed 's/.*: \(.*\);.*/\1/'` + if [ "$format" == "application/x-bzip2" ]; then + bzip2 --test $pkgfile || die "corrupted bzip2 package: $pkgfile" + elif [ "$format" == "application/x-xz" ]; then + xz --test $pkgfile || die "corrupted xz package: $pkgfile" + else + die "unsupported package format: $format" + fi sha1line=`sha1sum $pkgfile` [ ! -z "$sha1line" ] && pkgsha1sum=${sha1line% *} echo $pkgsha1sum _______________________________________________ Frugalware-git mailing list Frugalware-git@frugalware.org http://frugalware.org/mailman/listinfo/frugalware-git