Skip to content

Instantly share code, notes, and snippets.

@marcoemorais
Last active August 29, 2015 14:08
Show Gist options
  • Save marcoemorais/4edd8b40f640423d3ae8 to your computer and use it in GitHub Desktop.
Save marcoemorais/4edd8b40f640423d3ae8 to your computer and use it in GitHub Desktop.
look at the contents of an rpm without installing it on your system
#!/usr/bin/env bash
EXPECTED_ARGS=2
if [ $# -ne $EXPECTED_ARGS ]
then
echo "Usage: `basename $0` rpm-file target-dir"
exit 1
fi
set -e
RPM=$1
RPM_BASE=$(basename $RPM)
DIR=$2
if [ ! -d "$DIR" ]; then
mkdir -p "$DIR"
fi
cp $RPM $DIR
cd $DIR
rpm2cpio "$RPM_BASE" | cpio -idmv
rm $RPM_BASE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment