Skip to content

Instantly share code, notes, and snippets.

@blomquisg
Created May 22, 2017 16:53
Show Gist options
  • Save blomquisg/3d5362a4e66b453e53b767df9a6068a0 to your computer and use it in GitHub Desktop.
Save blomquisg/3d5362a4e66b453e53b767df9a6068a0 to your computer and use it in GitHub Desktop.
Find files that are different between the original RPM version and the current version on the filesystem
#!/bin/bash
PACKAGE_NAME='cfme'
echo "Finding list of files changed from $PACKAGE_NAME..."
changed_files=`rpm -V $PACKAGE_NAME | grep ".rb$" | cut -b 14-`
if [ "x$changed_files" == "x" ]; then
echo "Found no file changes"
exit 0
fi
echo "$changed_files"
echo "Downloading RPM file for $PACKAGE_NAME"
yumdownloader $PACKAGE_NAME &> /dev/null
PACKAGE_FILE=`ls $PACKAGE_NAME*.rpm`
echo "Extracting files from $PACKAGE_FILE"
rpm2cpio $PACKAGE_FILE | cpio -idm &> /dev/null
hostname=`hostname`
outfile="changed_files.$hostname"
echo "Finding changed file diffs"
for file in $changed_files; do
echo "$0 Diff for $file" | tee -a $outfile
echo "................................................................................................" | tee -a $outfile
diff -u "./$file" $file | tee -a $outfile
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment