archrelease: copy trunk to staging-x86_64
[arch-packages.git] / rpmextract / trunk / rpm2cpio
bloba0eba24032b3c6404e979dc01accee9e78f15b57
1 #!/bin/sh
3 pkg=$1
4 if [ "$pkg" = "" -o ! -e "$pkg" ]; then
5 echo "no package supplied" 1>&2
6 exit 1
7 fi
9 leadsize=96
10 o=`expr $leadsize + 8`
11 set `od -j $o -N 8 -t u1 $pkg`
12 il=`expr 256 \* \( 256 \* \( 256 \* $2 + $3 \) + $4 \) + $5`
13 dl=`expr 256 \* \( 256 \* \( 256 \* $6 + $7 \) + $8 \) + $9`
14 # echo "sig il: $il dl: $dl"
16 sigsize=`expr 8 + 16 \* $il + $dl`
17 o=`expr $o + $sigsize + \( 8 - \( $sigsize \% 8 \) \) \% 8 + 8`
18 set `od -j $o -N 8 -t u1 $pkg`
19 il=`expr 256 \* \( 256 \* \( 256 \* $2 + $3 \) + $4 \) + $5`
20 dl=`expr 256 \* \( 256 \* \( 256 \* $6 + $7 \) + $8 \) + $9`
21 # echo "hdr il: $il dl: $dl"
23 hdrsize=`expr 8 + 16 \* $il + $dl`
24 o=`expr $o + $hdrsize`
26 dd if=$pkg ibs=$o skip=1 2>/dev/null