summaryrefslogtreecommitdiffstats
path: root/extra/rpmextract/rpm2cpio
diff options
context:
space:
mode:
authorsibel <lesibel at free dot fr>2010-07-08 12:31:28 +0200
committersibel <lesibel at free dot fr>2010-07-08 12:31:28 +0200
commitaa7ce7edc786cab902e70e5e2d008422b877d998 (patch)
treea6a9dba2a0bcad11969119d2e3d6b53a3de13b4a /extra/rpmextract/rpm2cpio
parente9a02cfb305833d8f3686cb6403b12311224fff0 (diff)
downloadnutyx-pakxe-aa7ce7edc786cab902e70e5e2d008422b877d998.tar.gz
nutyx-pakxe-aa7ce7edc786cab902e70e5e2d008422b877d998.tar.bz2
nutyx-pakxe-aa7ce7edc786cab902e70e5e2d008422b877d998.tar.xz
nutyx-pakxe-aa7ce7edc786cab902e70e5e2d008422b877d998.zip
Ajout de rpmextract#1.0-1
Diffstat (limited to 'extra/rpmextract/rpm2cpio')
-rw-r--r--extra/rpmextract/rpm2cpio26
1 files changed, 26 insertions, 0 deletions
diff --git a/extra/rpmextract/rpm2cpio b/extra/rpmextract/rpm2cpio
new file mode 100644
index 000000000..a0eba2403
--- /dev/null
+++ b/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