diff options
author | Alastair Tse <liquidx@gentoo.org> | 2003-06-25 23:50:02 +0000 |
---|---|---|
committer | Alastair Tse <liquidx@gentoo.org> | 2003-06-25 23:50:02 +0000 |
commit | d17a8fda2ce9d598ed4b40ef0722f9507bd14601 (patch) | |
tree | 38f85b914b2ab2c5eb8e63b57cab5b64232d3eab /eclass | |
parent | added bzip2 detection patch (diff) | |
download | gentoo-2-d17a8fda2ce9d598ed4b40ef0722f9507bd14601.tar.gz gentoo-2-d17a8fda2ce9d598ed4b40ef0722f9507bd14601.tar.bz2 gentoo-2-d17a8fda2ce9d598ed4b40ef0722f9507bd14601.zip |
revised to handle the possibility of bzip2'ed rpms
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/rpm.eclass | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/eclass/rpm.eclass b/eclass/rpm.eclass index 995ec985307c..739f1f4e4525 100644 --- a/eclass/rpm.eclass +++ b/eclass/rpm.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/rpm.eclass,v 1.6 2003/06/22 16:31:23 liquidx Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/rpm.eclass,v 1.7 2003/06/25 23:50:02 liquidx Exp $ # Author : Alastair Tse <liquidx@gentoo.org> (21 Jun 2003) # @@ -37,7 +37,7 @@ newdepend "app-arch/rpm2targz" # extracts the contents of the RPM in ${WORKDIR} rpm_unpack() { - local rpmfile + local rpmfile rpmoff decompcmd rpmfile=$1 if [ -z "${rpmfile}" ]; then return 1 @@ -47,8 +47,15 @@ rpm_unpack() { if [ -x /usr/bin/rpm2cpio -a -z "${USE_RPMOFFSET_ONLY}" ]; then rpm2cpio ${rpmfile} | cpio -idmu --no-preserve-owner --quiet || return 1 else - dd ibs=`rpmoffset < ${rpmfile}` skip=1 if=${rpmfile} 2> /dev/null \ - | gzip -dc \ + rpmoff=`rpmoffset < ${rpmfile}` + [ -z "${rpmoff}" ] && return 1 + + decompcmd="gzip -dc" + if [ -n "`dd if=${rpmfile} skip=${rpmoff} bs=1 count=3 2>/dev/null | file - | grep bzip2`" ]; then + decompcmd="bzip2 -dc" + fi + dd ibs=${rpmoff} skip=1 if=${rpmfile} 2> /dev/null \ + | ${decompcmd} \ | cpio -idmu --no-preserve-owner --quiet || return 1 fi |