summaryrefslogtreecommitdiffstats
path: root/abs/extra/rpmextract
diff options
context:
space:
mode:
Diffstat (limited to 'abs/extra/rpmextract')
-rw-r--r--abs/extra/rpmextract/PKGBUILD20
-rw-r--r--abs/extra/rpmextract/rpm2cpio26
-rw-r--r--abs/extra/rpmextract/rpmextract.sh6
3 files changed, 52 insertions, 0 deletions
diff --git a/abs/extra/rpmextract/PKGBUILD b/abs/extra/rpmextract/PKGBUILD
new file mode 100644
index 0000000..1d76670
--- /dev/null
+++ b/abs/extra/rpmextract/PKGBUILD
@@ -0,0 +1,20 @@
+# $Id: PKGBUILD 83879 2010-06-23 15:55:24Z andrea $
+# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
+
+pkgname=rpmextract
+pkgver=1.0
+pkgrel=4
+pkgdesc="Script to convert or extract RPM archives (contains rpm2cpio)"
+url="http://www.archlinux.org"
+arch=('any')
+license=('GPL')
+depends=('bash' 'libarchive' 'coreutils')
+source=('rpmextract.sh' 'rpm2cpio')
+md5sums=('a7b527e4c210e66ef72532c606072e0d'
+ '57a4e99bedcefadc2f89006ce98d2e60')
+
+package() {
+ install -d ${pkgdir}/usr/bin
+ install -m755 ${srcdir}/rpmextract.sh ${pkgdir}/usr/bin/
+ install -m755 ${srcdir}/rpm2cpio ${pkgdir}/usr/bin/
+}
diff --git a/abs/extra/rpmextract/rpm2cpio b/abs/extra/rpmextract/rpm2cpio
new file mode 100644
index 0000000..a0eba24
--- /dev/null
+++ b/abs/extra/rpmextract/rpm2cpio
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+pkg=$1
+if [ "$pkg" = "" -o ! -e "$pkg" ]; then
+ echo "no package supplied" 1>&2
+ exit 1
+fi
+
+leadsize=96
+o=`expr $leadsize + 8`
+set `od -j $o -N 8 -t u1 $pkg`
+il=`expr 256 \* \( 256 \* \( 256 \* $2 + $3 \) + $4 \) + $5`
+dl=`expr 256 \* \( 256 \* \( 256 \* $6 + $7 \) + $8 \) + $9`
+# echo "sig il: $il dl: $dl"
+
+sigsize=`expr 8 + 16 \* $il + $dl`
+o=`expr $o + $sigsize + \( 8 - \( $sigsize \% 8 \) \) \% 8 + 8`
+set `od -j $o -N 8 -t u1 $pkg`
+il=`expr 256 \* \( 256 \* \( 256 \* $2 + $3 \) + $4 \) + $5`
+dl=`expr 256 \* \( 256 \* \( 256 \* $6 + $7 \) + $8 \) + $9`
+# echo "hdr il: $il dl: $dl"
+
+hdrsize=`expr 8 + 16 \* $il + $dl`
+o=`expr $o + $hdrsize`
+
+dd if=$pkg ibs=$o skip=1 2>/dev/null
diff --git a/abs/extra/rpmextract/rpmextract.sh b/abs/extra/rpmextract/rpmextract.sh
new file mode 100644
index 0000000..47ad01d
--- /dev/null
+++ b/abs/extra/rpmextract/rpmextract.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+if [ "$1" = "" -o ! -e "$1" ]; then
+ echo "no package supplied" 1>&2
+ exit 1
+fi
+rpm2cpio $1 | bsdtar -xf -