Created
November 20, 2014 03:55
-
-
Save joshuar/11a57620601e04156ba0 to your computer and use it in GitHub Desktop.
Email a diff of .rpmnew and .rpmsave file changes to an admin to consider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
mail_to=root | |
ignorefile=/etc/rpm-dispatch-conf.ignore | |
newfiles=$(find / -noleaf -ignore_readdir_race -xdev -name \*.rpmsave -or -name \*.rpmnew 2>/dev/null) | |
for f in $newfiles; do | |
newfile=$f | |
oldfile=$f | |
oldfile=${oldfile%%.rpmnew} | |
oldfile=${oldfile%%.rpmsave} | |
grep $oldfile /etc/rpm-dispatch-conf.ignore 1>/dev/null 2>&1 | |
if [[ $? ]]; then | |
mailfile=$(mktemp) | |
mail_subject="Subject: File needs updating: $oldfile" | |
echo >> ${mailfile} | |
echo "Add file to ${ignorefile} to ignore changes." >> ${mailfile} | |
echo >> ${mailfile} | |
diff -u $oldfile $newfile 1>> ${mailfile} 2>&1 | |
mail -s "${mail_subject}" ${mail_to} < ${mailfile} | |
test -e ${mailfile} && rm -f ${mailfile} | |
fi | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Details
This is a simple script that trawls your filesystem looking for 'rpmsave' or 'rpmnew' files that indicate a new upstream configuration changes that conflict with your local modifications. It will send an email to root for each of these files it encounters with a diff detailing what the changes are.
It is heavily inspired by Gentoo's dispatch-conf tool.
Instructions
Download this gist, make the script executable and then either configure it to run under cron (or another task scheduler) or run manually after updating your system.