LiteSpeed Linux server2.poyrazhosting.com 3.10.0-962.3.2.lve1.5.77.el7.x86_64 #1 SMP Mon Dec 12 07:06:14 EST 2022 x86_64 safemode : OFF MySQL: OFF | Perl: OFF | cURL: ON | WGet: OFF > / lib / rpm / | Server Ip : 172.67.216.244 |
Filename | /lib/rpm/rpm2cpio.sh |
Size | 1.3 kb |
Permission | rwxr-xr-x |
Owner | |
Create time | 08-Dec-2022 22:35 |
Last modified | 24-Nov-2021 16:33 |
Last accessed | 24-Nov-2021 16:33 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
#!/bin/sh
# Prevent gawk >= 4.0.x from getting funny ideas wrt UTF in printf()
LANG=C
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`
comp=`dd if="$pkg" ibs=$o skip=1 count=1 2>/dev/null \
| dd bs=3 count=1 2>/dev/null`
gz="`echo . | awk '{ printf("%c%c", 0x1f, 0x8b); }'`"
lzma="`echo . | awk '{ printf("%cLZ", 0xff); }'`"
xz="`echo . | awk '{ printf("%c7z", 0xfd); }'`"
case "$comp" in
BZh) dd if="$pkg" ibs=$o skip=1 2>/dev/null | bunzip2 ;;
"$gz"*) dd if="$pkg" ibs=$o skip=1 2>/dev/null | gunzip ;;
"$xz"*) dd if="$pkg" ibs=$o skip=1 2>/dev/null | xzcat ;;
"$lzma"*) dd if="$pkg" ibs=$o skip=1 2>/dev/null | unlzma ;;
*) echo "Unrecognized rpm file: $pkg"; exit 1 ;;
esac
# Prevent gawk >= 4.0.x from getting funny ideas wrt UTF in printf()
LANG=C
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`
comp=`dd if="$pkg" ibs=$o skip=1 count=1 2>/dev/null \
| dd bs=3 count=1 2>/dev/null`
gz="`echo . | awk '{ printf("%c%c", 0x1f, 0x8b); }'`"
lzma="`echo . | awk '{ printf("%cLZ", 0xff); }'`"
xz="`echo . | awk '{ printf("%c7z", 0xfd); }'`"
case "$comp" in
BZh) dd if="$pkg" ibs=$o skip=1 2>/dev/null | bunzip2 ;;
"$gz"*) dd if="$pkg" ibs=$o skip=1 2>/dev/null | gunzip ;;
"$xz"*) dd if="$pkg" ibs=$o skip=1 2>/dev/null | xzcat ;;
"$lzma"*) dd if="$pkg" ibs=$o skip=1 2>/dev/null | unlzma ;;
*) echo "Unrecognized rpm file: $pkg"; exit 1 ;;
esac