Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Minimal rpm2cpio using only bash, grep, tail and a decompressor

View rpm2cpio
1 2 3 4 5 6 7 8 9
#!/bin/bash
RPMHDRLGTH=$(LANG=C grep -abom1 '.7zXZ\|]'$'\000\000''....'$'\377\377\377\377\377\377''\|BZh9\|'$'\037\213\b' "$1")
case "$RPMHDRLGTH" in
*7zXZ) COMPRESSOR=xz ;;
*]*) COMPRESSOR=lzma ;;
*BZh9) COMPRESSOR=bzip2 ;;
*) COMPRESSOR=gzip ;;
esac
tail -c+$[${RPMHDRLGTH%:*}+1] "$1" | $COMPRESSOR -d
Owner
ruario commented

Just some notes. This assumes GNU tools. Additionally it will not work with rpm5.org rpm's that use xar instead of cpio internally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.