From f46714b9870abc1a1f41fe944159bc09b4cf33cb Mon Sep 17 00:00:00 2001
From: Michael Hanson <hansonorders@verizon.net>
Date: Tue, 7 Dec 2010 01:42:07 +0000
Subject: rpmextract: initial include for gsfonts

---
 abs/extra/rpmextract/PKGBUILD      | 20 ++++++++++++++++++++
 abs/extra/rpmextract/rpm2cpio      | 26 ++++++++++++++++++++++++++
 abs/extra/rpmextract/rpmextract.sh |  6 ++++++
 3 files changed, 52 insertions(+)
 create mode 100644 abs/extra/rpmextract/PKGBUILD
 create mode 100644 abs/extra/rpmextract/rpm2cpio
 create mode 100644 abs/extra/rpmextract/rpmextract.sh

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 -
-- 
cgit v0.12

